Android Question FileProvider crash at start

jtare

Active Member
Licensed User
Longtime User
I added the fileprovider class to my project but it crashes at the start, it doesn't show in the b4a logs but in crashlytics does.
Showing this:
B4X:
Fatal Exception: java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f06002d
       at android.app.ActivityThread.installProvider(ActivityThread.java:6621)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6173)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6079)
       at android.app.ActivityThread.-wrap1()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1791)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:7000)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)
Caused by android.content.res.Resources$NotFoundException: Unable to find resource ID #0x7f06002d
       at android.content.res.ResourcesImpl.getResourcePackageName(ResourcesImpl.java:273)
       at android.content.res.Resources.getResourcePackageName(Resources.java:1964)
       at com.google.android.gms.common.internal.StringResourceValueReader.<init>(com.google.android.gms:play-services-basement@@17.2.0:5)
       at com.google.firebase.FirebaseOptions.fromResource(com.google.firebase:firebase-common@@19.3.0:156)
       at com.google.firebase.FirebaseApp.initializeApp(com.google.firebase:firebase-common@@19.3.0:244)
       at com.google.firebase.provider.FirebaseInitProvider.onCreate(com.google.firebase:firebase-common@@19.3.0:51)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1925)
       at android.content.ContentProvider.attachInfo(ContentProvider.java:1900)
       at com.google.firebase.provider.FirebaseInitProvider.attachInfo(com.google.firebase:firebase-common@@19.3.0:45)
       at android.app.ActivityThread.installProvider(ActivityThread.java:6618)
       at android.app.ActivityThread.installContentProviders(ActivityThread.java:6173)
       at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6079)
       at android.app.ActivityThread.-wrap1()
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1791)
       at android.os.Handler.dispatchMessage(Handler.java:106)
       at android.os.Looper.loop(Looper.java:164)
       at android.app.ActivityThread.main(ActivityThread.java:7000)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:441)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1408)

The attached project crashes too, I added the libraries and manifest code that I use in the real project to the fileprovider example, I can't tell if it is exactly the same error but it seems to be.

Any idea of what could be causing the crash? Thanks
 

Attachments

  • FileProviderExample2.zip
    21.9 KB · Views: 118

jtare

Active Member
Licensed User
Longtime User
Run this example: https://www.b4x.com/android/forum/threads/class-fileprovider-share-files.97865/

Do you get the same error?

If so then the SDK is not configured properly. Download a new one as explained here: https://www.b4x.com/b4a.html
That example runs fine. No errors.

The problem begins when I add the firebase libraries, the manifest code of firebase and the additionaljars.

I also updated all the suggested items in the sdk manager but did not solved the issue.
 
Upvote 0

jtare

Active Member
Licensed User
Longtime User
Try to disable some components until you find the problematic one. It is probably related to FirebaseRemtoeConfig.
This is the line in the manifest that causes the app to crash
B4X:
CreateResourceFromFile(Macro, FirebaseAdMob.FirebaseAds)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Post your manifestcode. Guess you are missing a important snippet

Check
 
Upvote 0

jtare

Active Member
Licensed User
Longtime User
You are right, I didn't implement all the requirements for admob, but only on the example project that I uploaded in the first post and in which I was testing, on the real one is well implemented.

What actually fixed the issue was updating the recommended items in the sdk manager but since I was testing on the example project with the wrong implementation of admob made it harder to spot.

Thanks @Erel and @DonManfred
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…