Reputation: 734
AFter reading the following question:
Why are permissions being automatically added to my AndroidManifest when including Google Play Services library
I realized that I need to change my compiled items in build.gradle
.
currently I have compile 'com.google.android.gms:play-services:7.5.0'
but this is adding so many unnecessary permissions like location, permission to read and write to SD card, full network access, view network connections,etc. I am only using Google Play Services for leaderboards and achievements in my game. So I don't think I need any of those permissions on my app.
So what should I compile instead? I have to list the specific services, but I am unable to find a list of services so that I can pick and choose.
It would be something like:
compile 'com.google.android.gms:play-services-achievements7.5.0'
compile 'com.google.android.gms:play-services-leaderboards7.5.0'
I want as few permissions as possible for a game that only uses these services on Google Play.
I also have these permissions declared in my Manifest:
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
Can anyone provide me with the proper services to compile?
UPDATE Here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "mjj.fling"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
`dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.google.android.gms:play-services-games:7.5.0'
compile project(':BaseGameUtils')
apply plugin: 'com.google.gms.google-services'`
}
FAILURE: Build failed with an exception.
Error: more than one library with package name 'com.google.android.gms' You can temporarily disable this error with android.enforceUniquePackageName=false However, this is temporary and will be enforced in 1.0
And here is my error I get when I rebuild project.
BUILD FAILED
Upvotes: 2
Views: 2397
Reputation: 1341
Checkout https://developers.google.com/android/guides/setup for information from Google how to set up Play Services. Especially checkout the subsection titled Selectively compiling APIs into your executable
. It shows you how to breakdown which services to compile in. You'll probably want to use just the games one:
com.google.android.gms:play-services-games:7.5.0
In addition to using fewer permissions, it'll also reduce your APK size and method count, both good things to do anyways instead of pulling in the whole Play Services library.
Upvotes: 3