I have a library project FooLib which uses Google play service (location service). When I was using Eclipse, I have google-play-services-lib (also as a library project) in my workspace and I include it in FooLib, and everything is working fine. Now I am migrating to Android studio and I could not figure out a way to include Google play service in a library project. Here is what I have done so far:
- Installed Google player service, Google Repository in the SDK manager. (I am using the latest Android studio 1.0.1)
2. Added compile 'com.google.android.gms:play-services:6.5.+' to the build.gradle file for FooLib under dependencies. Sync the gradle file. Here is my guild.gradle file
apply plugin: 'com.android.library'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
minSdkVersion 8
targetSdkVersion 21
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.google.android.gms:play-services:6.5.+'
compile files('libs/aws-android-sdk-1.5.0-core.jar')
}
The official doc (http://developer.android.com/google/play-services/setup.html) mentioned that I also need to add
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
to the manifest as a child of <application> tag. But in the manifest file for a library project, there is no <application> tag. I tried without the meta-data tag or adding a dummy <application> tag in the manifest and attached meta-data tag to it. Neither case works.
I tried both AndroidManifest files below
Or
I am still getting
Does anybody know how to add Google play service to a library project in Android studio? Much appreciated!