0

I have an application which works fine on its own. I have tested everything in different api levels and it is working as a charm.

Now I have included this application as a library to a test application. Everything is working fine except for a feature. This feature gives the following error :

04-06 11:03:17.792 12545-12555/? E/DatabaseUtils: Writing exception to parcel
                                                  java.lang.SecurityException: Permission Denial: reading com.android.providers.media.MediaProvider uri content://media/external/images/media from pid=32652, uid=10096 requires android.permission.READ_EXTERNAL_STORAGE, or grantUriPermission()
                                                      at android.content.ContentProvider.enforceReadPermissionInner(ContentProvider.java:605)
                                                      at android.content.ContentProvider$Transport.enforceReadPermission(ContentProvider.java:480)
                                                      at android.content.ContentProvider$Transport.query(ContentProvider.java:211)
                                                      at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112)
                                                      at android.os.Binder.execTransact(Binder.java:453)
04-06 11:03:17.793 32652-32652/com.arlind.catapulttesting2:wallpaper_chooser D/AndroidRuntime: Shutting down VM
04-06 11:03:17.794 32652-32652/com.arlind.catapulttesting2:wallpaper_chooser E/AndroidRuntime: FATAL EXCEPTION: main

The following application which I am using as an external library has the necessary permissions on the AndroidManifest file. Both READ_EXTERNAL_STORAGE permission and the WRITE one.

When you add an external library, does the android manifest of the later one merges with that of the application which hosts it ? I even tried adding the same permissions on the AndroidManifest of the hosting application and it still says the same thing...

Not a duplicate, the application works fine when it is used on its own. It shows this error when it is used as an external library. It works fine on android api level 21 when the application is used as a library.

My targetSdkVersion was 23.

It appears on targetSdkVersion 22 it works fine even for android api level 23.

Does anyone have any thoughts on this ?

Lind
  • 277
  • 2
  • 5
  • 16
  • 1
    @marcin-orlowski why did you mark is as a duplicate ? The application works fine on its own which is the exact opposite of the question that you said it duplicates. – Lind Apr 06 '16 at 11:18
  • @marcin-orlowski I do not think you should take the liberty and close and mark my question as a duplicate when you do not not even bother to read it – Lind Apr 06 '16 at 11:31
  • Does it not work on Android M? It requires runtime permission, also what is your compileSdkVersion in build.gradle? – PravinCG Apr 06 '16 at 11:36
  • @PravinCG the application works from android api level 16 - 23 on its own. When added as a library, it does not work for android api level 23. More likely lets say that only one feature does not work, the one which requires this permission. – Lind Apr 06 '16 at 11:41
  • @Lind your question looks like dupe to me that's why I closed it. Aside I am wrong or not, your question lacks vital information that would allow others to understand how exactly your app is being built, what's targetSdk etc. You also did not spent time investigating merged Manifest even this should be one of first steps to take. Once you edit your question and provide all necessary information let me know, I'd gladly review my close. – Marcin Orlowski Apr 06 '16 at 11:46
  • @MarcinOrlowski you are right on the part that I did not spend time investigating the merged Manifest. I asked a question if it does merge to collect everyones oppinion, my idea is that it does since I already used tools replace on some conflicting issues. Since you said I do not provide enough information, if you check my other posts you will see that I always offer code and I always go into full detail. The idea is that I wanted a general answer on what could be wrong, I think the information that I provided might be enough for a general answer. Maybe I was wrong and that is another topic. – Lind Apr 06 '16 at 11:52
  • General answer would be based on guess and look like `something is wrong and not working`. Not sure it's worth an effort - you know that already. And that's why [create a Minimal, Complete, and Verifiable exampler](https://stackoverflow.com/help/mcve) is crucial if you want others to help. – Marcin Orlowski Apr 06 '16 at 11:54
  • @MarcinOrlowski that does not mean you should mark a question as duplicate without even reading it. How is mine similiar to that guy's question ? He has built an application to play mp3 files. His main application does not work and gives errors. The application that I am using works fine, I am trying to use it as an external library, it is failing for a certain android api level ... How are these the same ? Although the topic might be similiar, it is not remotely close to an exact duplicate ! Not even to a duplicate ! – Lind Apr 06 '16 at 11:55
  • @MarcinOrlowski it is minimal and complete. I am saying what happens, I have provided the error. I am saying when it happens. The only thing missing is the code, which is wayyyyyy too much, since it is an entire project. I want to know if everyone else has stumbled upon this problem, that is what I do mean by a general answer..... My question might be lacking on some terms, but that does not justify your action – Lind Apr 06 '16 at 11:57
  • @Lind perhaps targetSdk? Who knows - your question is to generic and cannot be narrowed to one case. Again - if you'd ask properl way, with details and maybe MCV, there'd be much higher chance you'd be now discussing your real problem now. – Marcin Orlowski Apr 06 '16 at 11:58
  • @MarcinOrlowski fair enough, I agree with your statement. I should have put more effort, you still should not have marked it as duplicate though ! – Lind Apr 06 '16 at 12:01
  • 1
    As I said edit your question so I can see I was wrong. I got no problems removing dupe mark – Marcin Orlowski Apr 06 '16 at 12:03
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/108399/discussion-between-lind-and-marcin-orlowski). – Lind Apr 06 '16 at 12:05

0 Answers0