can't upload apk: READ_EXTERNAL_STORAGE with d

2019-02-19 04:19发布

问题:

This is the first time I ask a question here.
Anyway, as the title says, I'm trying to put my application on the market.
When I try to upload the signed apk, I get the error:

Upload failed Duplicate declarations of permission android.permission.READ_EXTERNAL_STORAGE with different maxSdkVersions.

I tried searching through the existent questions, but I can't find a solution.

...
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECORD_VIDEO" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<!-- needed to retrieve owner name -->
<uses-permission android:name="android.permission.READ_PROFILE" />
...

The problem is that I don't ask explicitly for this permission. I have the WRITE_EXTERNAL_STORAGE declared in the manifest, and this should include the READ_EXTERNAL_STORAGE permission, but without the "maxsdkversion".

I also looked into the libraries that I'm importing.

Before going on, I have two versions of the app, one for android 2.3+, one for android 4+. I can upload the Android 2.3+ version without any problem.

The only different thing between the two versions is that in the "android 4+" version i'm importing the "creativeSDKImageEditing" (Aviary). I saw that in the manifest of the CreativeSDK it's declared the READ_EXTERNAL_STORAGE permission, but without any "maxSdkVersion".

...
compile 'com.android.support:support-v4:22.2.1'
compile 'com.android.support:appcompat-v7:22.2.1'

compile 'com.facebook.android:facebook-android-sdk:4.1.1'
compile 'com.github.chrisbanes.photoview:library:1.2.3'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.squareup.okhttp:okhttp:2.4.0' 
compile 'com.nineoldandroids:library:2.4.0@jar'
compile 'com.mixpanel.android:mixpanel-android:4.6.0'
compile 'com.intellij:annotations:12.0'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.3'
compile 'com.github.johnkil.android-appmsg:appmsg:1.2.0'
compile 'ch.acra:acra:4.6.2'
compile 'com.android.support:multidex:1.0.0'

compile 'com.adobe.creativesdk.foundation:auth:0.3.94'
compile 'com.adobe.creativesdk:image:4.0.0'
...

I'm facing this issue only now, with the new update, while before I uploaded both versions of the app without any problem. I haven't changed the manifest, nor the gradle files, so I really don't know what's happening.

I'm using the latest version of Android Studio and the gradle plugin 1.2.3.
Can anybody help me?

回答1:

I still don't know why it is happening, but it looks like that there was something inside a library (even if i checked their manifest).
Anyway the solution for me was to delete the permission of the library declaring in my manifest:

<uses-permission
    android:name="android.permission.READ_EXTERNAL_STORAGE"
    tools:node="remove"
    tools:selector="com.aviary.android.feather.sdk" />

Evverything works fine, even if there is no "maxsdkversion" declared in that library manifest.



回答2:

Including android.permission.READ_EXTERNAL_STORAGE resolves the problem