I've recently started designing an app with Android studio and it seems Android Studio is adding things to my manifest without my knowledge.
For example it has added a service:com.google.android.gms.measurement.AppMeasurementService
that I have no idea why it's there. And it also adds permissions such as:
com.google.android.c2dmpermission.RECEIVE
android.permission.USE_CREDENTIALS
This increases the size and memory consumption of my app so I want to get rid of it but I haven't figured out how.
Thought it maybe was in the "Project Structure" menu item in Android but can't find anywhere to turn it off. All the Developers Services are turned off (even though Analytics seem to have been activt by default but I turned it off).
Would appreciate any pointers to how I can remove all this automatically added stuff?
Thanks
Edit: After further investigation it turns out that my AndrodManifest.xml in the
build\intermediates\manifests\full\release
directory contains a lot of additional information:
<!-- Include the AdActivity and InAppPurchaseActivity configChanges and themes. -->
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent" />
<activity
android:name="com.google.android.gms.ads.purchase.InAppPurchaseActivity"
android:theme="@style/Theme.IAPTheme" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
<provider
android:name="com.google.android.gms.measurement.AppMeasurementContentProvider"
android:authorities="net.stefano.stefanoface.google_measurement_service"
android:exported="false" />
<receiver
android:name="com.google.android.gms.measurement.AppMeasurementReceiver"
android:enabled="true" >
<intent-filter>
<action android:name="com.google.android.gms.measurement.UPLOAD" />
</intent-filter>
</receiver>
<service
android:name="com.google.android.gms.measurement.AppMeasurementService"
android:enabled="true"
android:exported="false" />
<meta-data
android:name="com.google.android.wearable.beta.app"
android:resource="@xml/android_wear_micro_apk" />
It seems AdActivity and InAppPurchaseActivity is automatically added but all developer servics are turned off in the "Project Structure". Why is this there anyway?
The build.gradle file:
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "net.stefano.stefanoface"
minSdkVersion 18
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
wearApp project(':wear')
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.google.android.gms:play-services:8.1.0'
compile 'com.android.support:design:22.2.1'
compile 'com.google.android.gms:play-services-base:7.5.0'
}
Yes, I'm developing a wear app so I do need access to Google Play Services but only the Wear part.
Thanks
Go into your module's build.gradle
file (e.g., app/build.gradle
). Look at the dependencies
closure. You should have 1+ entries in there, with at least one coming from the Play Services SDK, based on your symptoms. Identify what you have there, and remove the items that you do not want.
See also this SO answer and this blog post.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With