Android Question App Crashes when adding Firebase manifest text

JohnC

Expert
Licensed User
Longtime User
I am trying to ad ADMOB ads to my app and I am following this tutorial:

https://www.b4x.com/android/forum/threads/integrating-firebase-services.67692/
But, my app crashes right out of the gate. the IDE debug even gives an error that is was not able to connect to the device right after it deployed it, so there is no LOG data to report.

I narrowed the problem to when I add the manifest text from this section of the tutorial:

Always required when using Firebase

How can I figure out what is wrong - I cut and pasted the text correctly.

If I remove this section from the manifest, my app starts fine.
 

JohnC

Expert
Licensed User
Longtime User
This is the section of that manifest code that will make my app crash:

B4X:
   <provider
  android:authorities="${applicationId}.firebaseinitprovider"
  android:name="com.google.firebase.provider.FirebaseInitProvider"
  android:exported="false"
  android:initOrder="100" />

Any idea why?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
The crash is happening even before my app runs the "Service_Create" of the Starter Service!

B4X:
ub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    Dim A As String
   
    A = "TEST"
End Sub

I placed a breakpoint on the 'A = "TEST"' line, and it didnt' even trigger!

I tried this on two different physical phones (4.2.2, and 5.1.1) and the same thing happens.

So something is up with that manifest entry.

I have some questions:

1) Does the APK or even the app have to be first created/uploaded to the google developer console?
2) Were is it getting the "applicationId" value from?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I tried that with two different devices (4.2.2 and 5.1.1) and tried deploying/running in both release and debug mode and NOTHING appears in the log at all.

I even tried clicking "Connect" after the crash to see if it could flush out any errors from the devices error log and still comes up completely blank.

On the 4.2.2, the screen turns white (because of the light them I am using) and then says "Unfortunetely, MyApp has stopped". Then the IDE says "Rapid Debugger failed to connect to device":

firebase-crash.png


And to prove that my device is configured correctly and is connected properly, below is a screen shot when I remove those 5 lines from the manifest and rerun it:

firebase-ok.png
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
OK, after going through a LOT of misc events, I found this - why is it not find it?

B4X:
FATAL EXCEPTION: main
Process: com.omnisoft.voiceit, PID: 11162
java.lang.RuntimeException: Unable to get provider com.google.firebase.provider.FirebaseInitProvider: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.omnisoft.voiceit-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
 at android.app.ActivityThread.installProvider(ActivityThread.java:5311)
 at android.app.ActivityThread.installContentProviders(ActivityThread.java:4897)
 at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4831)
 at android.app.ActivityThread.access$1900(ActivityThread.java:165)
 at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1442)
 at android.os.Handler.dispatchMessage(Handler.java:102)
 at android.os.Looper.loop(Looper.java:135)
 at android.app.ActivityThread.main(ActivityThread.java:5593)
 at java.lang.reflect.Method.invoke(Native Method)
 at java.lang.reflect.Method.invoke(Method.java:372)
 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:960)
 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: DexPathList[[zip file "/data/app/com.omnisoft.voiceit-2/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]
 at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
 at android.app.ActivityThread.installProvider(ActivityThread.java:5296)
 ... 11 more
 Suppressed: java.lang.ClassNotFoundException: com.google.firebase.provider.FirebaseInitProvider
 at java.lang.Class.classForName(Native Method)
 at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
 at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
 ... 13 more
 Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
 
Last edited:
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I am ONLY using two different real physical devices (Samsung S4 4.2.2 and a Huawei 5.1.1.)

The Huawei is a brand new unit that is stock.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Yes I am using B4A 6.

I did not see any mention of adding a reference to the FirebaseAdMob library in the tutorial. How would I do that?
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
That was it!

I had already added the firebaseadmob.jar and .xml to the addlibs folder, but forgot to checkbox that lib - I had the older "Admob" lib checked.

It runs ok now - thanks Erel!
 
Upvote 0
Top