Android Question Unfortunately, Google Maps app has stopped

peacemaker

Expert
Licensed User
Longtime User
My app was compiled and working OK with Google Maps for markers and for routes API, when was built with the old SDK, without Firebase.
Other app push messages sample with Firebase is compiled and working OK, with the new SDK verision. So, Firebase looks working...

But now i cannot start and even debug the first Google Map app, made all according to the tutorial - "Unfortunately, App has stopped" just after run.

SDK updated, API level min14, target22, JSON from Firebase, its snippet, API key from the console snippet....
How to understand why crashed ?
 
Last edited:

peacemaker

Expert
Licensed User
Longtime User
Checked the unfiltered log and found:

B4X:
FATAL EXCEPTION: main
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: /data/app/peacemaker.myparty-1.apk
    at android.app.ActivityThread.installProvider(ActivityThread.java:4822)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:4432)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4372)
    at android.app.ActivityThread.access$1300(ActivityThread.java:141)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1294)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.firebase.provider.FirebaseInitProvider" on path: /data/app/peacemaker.myparty-1.apk
    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:65)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
    at android.app.ActivityThread.installProvider(ActivityThread.java:4807)
    ... 12 more
  Force finishing activity peacemaker.myparty/.main

Removed Firebase Manifest snippet, added back "meta-data"
B4X:
AddApplicationText(<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzaS......"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>)
AddPermission(android.permission.ACCESS_NETWORK_STATE)

And now starts OK, but... seems, it's not according to the tutorial for B4A 6+.

And now such error at "mFragment.Initialize("Map", MapPanel)":
B4X:
** Service (starter) Create **
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (serv) Create **
** Service (serv) Start **
** Activity (main) Pause, UserClosed = false **
** Activity (mymap) Create, isFirst = true **
** Activity (mymap) Resume **
java.lang.RuntimeException: java.lang.NullPointerException
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:196)
    at com.google.android.gms.maps.MapFragment$zza$1.zza(Unknown Source)
    at com.google.android.gms.maps.internal.zzt$zza.onTransact(Unknown Source)
    at android.os.Binder.transact(Binder.java:310)
    at aai.a(:com.google.android.gms.DynamiteModulesB:82)
    at maps.ad.t$5.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:137)
    at android.app.ActivityThread.main(ActivityThread.java:5041)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
    at anywheresoftware.b4a.objects.MapFragmentWrapper$1.onMapReady(MapFragmentWrapper.java:181)
    ... 14 more

But if to make a breakpoint on this init - no error next.
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
"Spoiler: B4A v6+" asks to use Firebase and short META_DATA snipped, but with it
B4X:
java.lang.IllegalStateException: A required meta-data tag in your app's AndroidManifest.xml does not exist.  You must have the following declaration within the <application> element:     <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

And works only with old long snippet:
B4X:
AddApplicationText(<meta-data
    android:name="com.google.android.maps.v2.API_KEY"
    android:value="AIzaSy......"/>
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version"/>)

And new #AdditionalJar: com.google.android.gmslay-services-maps is used, for sure.

And yes, thanks - if by loading the layout with a MapFragment - it is OK (if to use the sub prefix = MapFragment name).
Now only by CustomView must be ? Before it was ok by runtime init.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…