迁移到 Android Studio - 现在我的应用请求额外的权限

Migrated to Android Studio - now my app requests additional permissions

我刚刚将一个应用程序从 Eclipse 迁移到 Android Studio。我尝试导出已签名的 APK 并将其上传到 Google Play,只是为了检查一切是否正常。

那时我注意到我的应用程序现在请求两个额外的权限,除了我在清单中声明的​​权限!这两个权限是 android.permission.WAKE_LOCKcom.google.android.c2dm.permission.RECEIVE

这是怎么回事?自上次上传应用程序以来,我没有更改任何代码,并且清单未声明这些权限。我猜某些 Google 组件对此负责,但为什么会因为我迁移到 Android Studio 而发生这种情况?我可以关闭这些权限吗?

我正在使用 Google Play 服务和 Google AdMob,但我已经在没有这些权限的情况下使用了很长时间...

manifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.example.app"
      android:versionCode="70"
      android:versionName="7.0" >

    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="com.android.vending.CHECK_LICENSE" />

    <uses-sdk 
        android:minSdkVersion="10"
        android:targetSdkVersion="23" />

    <application android:name="com.example.app.MyApplication"
                 android:icon="@mipmap/ic_launcher_icon" 
                 android:label="@string/app_name" 
                 android:allowBackup="true"
                 android:uiOptions="none">

        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />


        <activity android:name="com.example.app.MainActivity"
                  android:label="@string/app_name"
                  android:theme="@style/Theme.MyTheme.App"
                  android:windowSoftInputMode="adjustPan" >

                    <intent-filter>
                        <action android:name="android.intent.action.MAIN" />
                        <category android:name="android.intent.category.LAUNCHER" />
                    </intent-filter>
        </activity>

        <activity           
            android:name="com.example.app.OtherActivity"
            android:label="@string/otherActivityTitle"
            android:theme="@style/Theme.MyTheme.App"
            android:parentActivityName="com.example.app.MainActivity" >

            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.app.MainActivity" />                                 
        </activity>                     

        <activity
            android:name="com.example.app.PreferencesActivity"
            android:label="@string/prefsTitle" >            
        </activity>                     

        <activity android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />


    </application>
</manifest>

这是使用 Android Studio 构建的 APK 的屏幕截图:

我无法将语言更改为英语,但它基本上说它现在支持的设备减少了 22 个,需要 2 个新权限并使用 OpenGL 2.0+ 而不是 1.0+。

这是使用 Eclipse 构建的同一个 APK 的屏幕截图:

改为:

android:targetSdkVersion="22"

经过更多搜索,我在 Whosebug 上找到了这个帖子:

那里的一个答案(不是被接受的答案)解决了我的问题。 Android Studio 导入过程似乎将此依赖项添加到我的 build.gradle:

compile 'com.google.android.gms:play-services:+'

改成后

compile 'com.google.android.gms:play-services-base:8.4.0' // Needed for API Availability test
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-analytics:8.4.0'

APK 不再请求不需要的权限,它针对与以前相同的设备并使用与以前相同的 OpenGL 版本 - 即一切都回到了 Eclipse 的方式!除了现在 APK 的文件大小减少了 1 MB 作为额外奖励!

对于以后来这里的人,您可能需要调查在 Gradle, please and/or Setting up Google Play Services.

上应该使用什么 Google Play 服务版本号