Android Question Google map problem: java.lang.NoClassDefFoundError: Failed resolution

uniplan

Active Member
Licensed User
Longtime User
Hi,
I'm Following this example
(https://www.b4x.com/android/forum/threads/google-maps.63930/#content)
to create a simple google map page into my application, but i have this error in the log file.


java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/MapFragment;
at anywheresoftware.b4a.objects.MapFragmentWrapper.Initialize(MapFragmentWrapper.java:120)
at anywheresoftware.b4a.objects.MapFragmentWrapper.DesignerCreateView(MapFragmentWrapper.java:105)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:70)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at uniplan.greenapp.frmmapisolaecologica.afterFirstLayout(frmmapisolaecologica.java:102)
at uniplan.greenapp.frmmapisolaecologica.access$000(frmmapisolaecologica.java:17)
at uniplan.greenapp.frmmapisolaecologica$WaitForLayout.run(frmmapisolaecologica.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5938)
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:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/uniplan.greenapp-2/base.apk"],nativeLibraryDirectories=[/data/app/uniplan.greenapp-2/lib/arm, /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)
... 24 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
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)
... 25 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
** Activity (frmmapisolaecologica) Resume **

You can help me to solve it?
Thank you
 
Last edited:

uniplan

Active Member
Licensed User
Longtime User
Hi,
I'm Following this example to create a simple google map page into my application, but i have this error in the log file.


java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/maps/MapFragment;
at anywheresoftware.b4a.objects.MapFragmentWrapper.Initialize(MapFragmentWrapper.java:120)
at anywheresoftware.b4a.objects.MapFragmentWrapper.DesignerCreateView(MapFragmentWrapper.java:105)
at anywheresoftware.b4a.objects.CustomViewWrapper.AfterDesignerScript(CustomViewWrapper.java:70)
at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:158)
at anywheresoftware.b4a.objects.PanelWrapper.LoadLayout(PanelWrapper.java:134)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:710)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:342)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:249)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
at uniplan.greenapp.frmmapisolaecologica.afterFirstLayout(frmmapisolaecologica.java:102)
at uniplan.greenapp.frmmapisolaecologica.access$000(frmmapisolaecologica.java:17)
at uniplan.greenapp.frmmapisolaecologica$WaitForLayout.run(frmmapisolaecologica.java:80)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:145)
at android.app.ActivityThread.main(ActivityThread.java:5938)
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:1400)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.gms.maps.MapFragment" on path: DexPathList[[zip file "/data/app/uniplan.greenapp-2/base.apk"],nativeLibraryDirectories=[/data/app/uniplan.greenapp-2/lib/arm, /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)
... 24 more
Suppressed: java.lang.ClassNotFoundException: com.google.android.gms.maps.MapFragment
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)
... 25 more
Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
** Activity (frmmapisolaecologica) Resume **

You can help me to solve it?
Thank you

The error message appear when i try to call a method on MapFragment object
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Without seeing your code we hardly can´t help
 
Upvote 0

uniplan

Active Member
Licensed User
Longtime User
The problem i think it's any customization of my project becouse the page is simple (look to the bottom)...
I try to create a simple new application i put all in the main with same code and it work (Here i don't have firebase notification,facebook and google connect etc..it's simple)
In my project where don't work i have navdrawer and it is in the another activity page.

B4X:
#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

#Region  Activity Attributes
   #FullScreen: False
   #IncludeTitle: True
#End Region

'Activity module
Sub Process_Globals

End Sub

Sub Globals
    Private gmap As GoogleMap

    Private MapFragmentIsoleEcologiche As MapFragment
End Sub

Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("frmMapIsoleEcologiche")
    If MapFragmentIsoleEcologiche.IsGooglePlayServicesAvailable = False Then
        ToastMessageShow("Please install Google Play Services.", True)
    End If
End Sub

Sub MapFragmentIsoleEcologiche_Ready
    gmap = MapFragmentIsoleEcologiche.GetMap
    Dim m1 As Marker = gmap.AddMarker(10, 30, "test")
    m1.Snippet = "This is the snippet"
End Sub
 
Upvote 0

uniplan

Active Member
Licensed User
Longtime User
if my experience can help someone....i had this
'#AdditionalRes: $AdditionalLibs$\extra-res\identity, com.google.identitytoolkit
'#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .nearby, .maps
'#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm
'#ExcludeClasses: .ads
in the additional attribute that goes in conflict with google map library,i commented it and i solved the problem.


B4X:
#Region  Project Attributes
    #ApplicationLabel: GreenApp
    #VersionCode: 8
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    '#AdditionalRes: $AdditionalLibs$\extra-res\identity, com.google.identitytoolkit
    '#ExcludeClasses: .games, .drive, .fitness, .wearable, .measurement, .cast, .nearby, .maps
    '#ExcludeClasses: .tagmanager, .analytics, .wallet, .plus, .vision, .gcm
    '#ExcludeClasses: .ads
    #AdditionalRes: ..\resource
    #AdditionalRes: ..\resource_tastytoast
    #AdditionalJar: com.google.android.gms:play-services-maps
    #Extends: android.support.v7.app.AppCompatActivity
#End Region
 
Upvote 0
Top