How to import gms to our project - using Android.mk

来源:互联网 发布:股票历史分时数据获取 编辑:程序博客网 时间:2024/06/14 01:40
1. Download google play services using sdk Manager.
2. Copy the library project to the location where maintain your android app projects.
3. In Eclipse, import it. File->Import, select Android > Exsting Android Code into Workspace, add browser to the copy of the library project to import it.
4. Right click this project, select Export > JAR file, select gen and src directory, diselect other directories, like the attachments, click finish.
5, Copy this generated jar file(for example, google-play-services_lib.jar) and libs/google-play-services.jar to camera project's jarlib directory.
6. Edit Android.mk of camera project, add these lines:
    LOCAL_STATIC_JAVA_LIBRARIES += googleplayservices
    LOCAL_STATIC_JAVA_LIBRARIES += googleplayservices_lib

    LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += googleplayservices_lib:jarlib/google-play-services_lib.jar
    LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES += googleplayservices:jarlib/google-play-services.jar
7. Copy res/values/version.xm under gms project to camera project res/values/ directories.
8. Edit AndroidManifest.xml of camera project, add the following tag as a child of the <application> element:
    <meta-data android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />
9. If you encounter proguard issue, copy these directories under android-sdk/tools/proguard/ to external/proguard, replace old one(make sure version under android sdk is newer than those unser android source):
    bin/ lib/
0 0
原创粉丝点击