我最近开始用Android studio设计一个应用程序,似乎Android Studio在我不知情的情况下向我的清单中添加了一些东西。
例如,它添加了一项服务:
com.google.android.gms.measurement.AppMeasurementService
我不知道它为什么会在那里。它还添加了如下权限:
com.google.android.c2dmpermission.RECEIVE
android.permission.USE_CREDENTIALS
这增加了我的应用程序的大小和内存消耗,所以我想摆脱它,但我还没有弄清楚怎么做。
我会感激任何关于我如何删除所有这些自动添加的东西的指针?
谢谢
编辑:经过进一步的调查,我的AndrodManifest.xml在
build\intermediates\manifests\full\release
目录包含大量附加信息:
<!-- 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" />
为什么它会在那里呢?
build.gradle文件:
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'
}
是的,我正在开发一个穿戴应用程序,所以我确实需要访问Google Play服务,但只需要穿戴部分。
谢谢
发布于 2015-10-27 19:41:41
进入模块的build.gradle
文件(例如,app/build.gradle
)。看看dependencies
闭包。根据您的症状,您应该在其中有1+条目,其中至少有一个条目来自Play Services SDK。确定您在那里有什么,并删除您不需要的项目。
https://stackoverflow.com/questions/33366846
复制相似问题