Skip to content
This repository was archived by the owner on Feb 19, 2020. It is now read-only.
This repository was archived by the owner on Feb 19, 2020. It is now read-only.

WRITE_EXTERNAL_STORAGE permission is removed by HockeyApp #356

Closed
@smuldr

Description

@smuldr

The HockeyApp SDK sets an android:maxSdkVersion="18" attribute on the WRITE_EXTERNAL_STORAGE permission in its AndroidManifest, which removes the permission on higher API levels. I don't know why this attribute is there, but it is causing problems in our app.

Example: Our app uses LeakCanary and Spoon, both of which require this permission to work correctly. Even though we put the <uses-permission> tag in our debug AndroidManifest, these tools always fail. Apparently the merged manifest also contains the android:maxSdkVersion attribute. These kind of hidden attributes are very difficult to discover. I actually thought it was some new security policy in Android that was causing LeakCanary to fail.

Is it possible to remove the attribute from the SDK, and leave the permissions up to the end user? Perhaps HockeyApp can print a warning in the Logs or a show Toast if the permission is missing.

Activity

smuldr

smuldr commented on Jan 26, 2018

@smuldr
ContributorAuthor

For anyone having the same issue, you can remove the android:MaxSdkVersion attribute from the merged manifest as follows.

<uses-permission
    android:name="android.permission.WRITE_EXTERNAL_STORAGE"
    tools:remove="android:maxSdkVersion" />
MatkovIvan

MatkovIvan commented on Jan 26, 2018

@MatkovIvan
Contributor

Duplicate of #301

MatkovIvan

MatkovIvan commented on Jan 26, 2018

@MatkovIvan
Contributor

Hi @smuldr,

This is described in our documentation and release notes:

To be ready for Android O, HockeySDK-Android now limits the WRITE_EXTERNAL_STORAGE permission with the maxSdkVersion filter. In some use cases, e.g. where an app contains a dependency that requires this permission, maxSdkVersion makes it impossible for those dependencies to grant or request the permission. The solution for those cases is to declare the tools:node="replace" manifest merging strategy later in the dependency tree:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>

Best,
Ivan

Iqra786

Iqra786 commented on Feb 22, 2018

@Iqra786

Hi,

I have tried all solution but no success.

ElektrojungeAtWork

ElektrojungeAtWork commented on Feb 22, 2018

@ElektrojungeAtWork
Contributor

Hi @Iqra786,

have you tried <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/> as well as
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove" />?

Iqra786

Iqra786 commented on Feb 23, 2018

@Iqra786

Hi, @TroubleMakerBen

Yes, I have tried both.

ElektrojungeAtWork

ElektrojungeAtWork commented on Feb 23, 2018

@ElektrojungeAtWork
Contributor

Is there any chance you can send us the project (or a sample that has this behavior)? We cannot repro this and I'm running out of ideas. To do that, please contact us via Support and mention this conversation.

Thx a ton!

tobi512

tobi512 commented on Mar 27, 2018

@tobi512

@Iqra786 @TroubleMakerBen
I can confirm that replacing the maxSdkVersion works as expected for us with the following ways: tools:node="replace" and tools:remove="android:maxSdkVersion".
However, tools:node="remove" only removes the permission itself and not the maxSdkVersion restriction, so don't use this!

We also have Spoon and LeakCanary besides HockeySDK in our project, did you make sure to check your merged manifest (tab "Merged Manifest" in Android Studio).
If you have multiple manifest files in your project for more than one module, you should also check if the right one is used.

The following screenshots show the difference in our final merged manifest (first one without the additional code, resulting in the maxSdkVersion to be incorrectly present, and the second one with the maxSdkVersion replaced/removed correctly).

maxsdkversionpresent

maxsdkversionremoved

Hope this helps you in finding your problem cause...

Btw: don't ask me why the READ_EXTERNAL_STORAGE permission occurs twice in the final merge result 😄

rusmonster

rusmonster commented on Jul 24, 2018

@rusmonster

Adding tools:node="replace" helps for me, but now I have the warning

Task :app:processDebugManifest /Android/app/AndroidManifest.xml:6:2-131 Warning: uses-permission#android.permission.WRITE_EXTERNAL_STORAGE was tagged at AndroidManifest.xml:6 to replace another declaration but no other declaration present

Any ideas how to avoid or at least suppress it?

jaeklim

jaeklim commented on Jul 24, 2018

@jaeklim
Collaborator

@rusmonster The warning tells you that you don't have any tags to be replaced. Looks like your project doesn't contain HockeyApp dependencies, can you make sure your app contains HockeyApp libraries in it?

rusmonster

rusmonster commented on Jul 25, 2018

@rusmonster

@jaelim-ms Yes, I'm sure my app contains hockeyApp. Moreover, without tools:node="replace" hockeyApp drops WRITE_EXTERNAL_STORAGE in my app on API > 18 and adding the tools:node="replace" returns it back. So the warning looks like manifest merger issue. I'm just asking about how to suppress it?

jaeklim

jaeklim commented on Jul 25, 2018

@jaeklim
Collaborator

@rusmonster I've tried to find a way to suppress the warning but couldn't find any. Sorry about that. I keep searching it and let you know if I find but the warning isn't from lint so I don't think you can suppress it.

jaeklim

jaeklim commented on Jul 30, 2018

@jaeklim
Collaborator

We have another open issue regarding the permission issue. Please continue conversation in #373.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rusmonster@MatkovIvan@smuldr@Iqra786@tobi512

        Issue actions

          WRITE_EXTERNAL_STORAGE permission is removed by HockeyApp · Issue #356 · bitstadium/HockeySDK-Android