Android Question App Crashing (Solved)

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi All,

A problem.
Existing App updated for Runtime Permissions.

Install App OK.
Attempt to open App and it crashes, it does not report line numbers etc.
This occurs in release and debug modes. Also the same result if a fresh install or installing over existing [working] App.

The App installs OK a Galaxy Note 3 [Android 5] and a LG V20 [Android 8].
The problem occurs on a Galaxy Tab A [Android 9].
I suspect a timing issue due to the Tab A running faster but I really have no idea.

I am working my way through using Log() to narrow down where exactly it is crashing.
Can someone please tell what the crash info from the Log means. Crash info and code below.

I know this isn't much to go on but if someone can translate the LOG to SIMPLE i would appreciate it.

Regards Roger


B4X:
Sub Activity_PermissionResult (Permission As String, Result As Boolean)

End Sub

Sub mFragment_Ready
Log(" Start of mFragment_Ready") 
    gmap = mFragment.GetMap
Log("gmap")
   
'   '*****Added as part of Map upgrade 10 Aug 19                  
    rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
    Wait For Activity_PermissionResult (Permission As String, Result As Boolean)  

'**** Requests permission but crashes before user responds
  
    gmap.MyLocationEnabled = Result


   
   If gmap.IsInitialized = False Then
        ToastMessageShow("Error initializing map.", True)
   Else
       ' Do stuff
   Then
       ' More stuff
  
Log(" End of mFragment_Ready Sub")
  
End Sub


Logger connected to: samsung SM-T510
--------- beginning of main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Start of mFragment_Ready
gmap
** Activity (main) Pause, UserClosed = false **
No wakelock.
--------- beginning of system
--------- beginning of crash
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/http/ProtocolVersion;
at ce.b:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):3)
at cb.a:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):3)
at cd.a:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):14)
at com.google.maps.api.android.lib6.drd.aj.a:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):4)
at bf.a:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):22)
at bf.run:)com.google.android.gms.dynamite_mapsdynamite@[email protected] (100304-269183835):8)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.http.ProtocolVersion" on path: DexPathList[[zip file "/data/user_de/0/com.google.android.gms/app_chimera/m/00000029/MapsDynamite.apk"],nativeLibraryDirectories=[/data/user_de/0/com.google.android.gms/app_chimera/m/00000029/MapsDynamite.apk!/lib/armeabi-v7a, /data/user_de/0/com.google.android.gms/app_chimera/m/00000029/MapsDynamite.apk!/lib/armeabi, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:134)
at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
at ad.loadClass:)com.google.android.gms.dynamite_dynamiteloader@[email protected] (100304-269183835):4)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 6 more
 

Roger Daley

Well-Known Member
Licensed User
Longtime User
Hi Erel,

Manifest below.

" android:value="AIzaSyAn4mAf8Nqha2H5oHHYvbCx9Ge37??????"/>)" is dummy for this reply only

'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136

AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")

CreateResourceFromFile(Macro, FirebaseAnalytics.GooglePlayBase)
CreateResourceFromFile(Macro, Themes.DarkTheme)
'End of default text.

AddManifestText( <permission
android:name="$PACKAGE$.permission.MAPS_RECEIVE"
android:protectionLevel="signature"/>
<uses-feature android:glEsVersion="0x00020000" android:required="true"/>)

AddApplicationText( <meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" /> )

AddApplicationText(<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyAn4mAf8Nqha2H5oHHYvbCx9Ge37??????"/>)

AddPermission(android.permission.ACCESS_NETWORK_STATE)

Regards Roger
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i dont see any addpermission?

also i´m missing

B4X:
AddApplicationText(
<uses-library
      android:name="org.apache.http.legacy"
      android:required="false" />
)

The last is the source of your problem

Go again over the googlemap tutorial and also go again over the runtimepermissions tutorial.
 
Upvote 0

Roger Daley

Well-Known Member
Licensed User
Longtime User
Thankyou DonManfred,

Once again you've come to the rescue. The "AddApplicationText" code was indeed the problem, I'm surprised that the App was working on the earlier devices without it, but that's computers for you.
Reading back over the Maps Tutorial, the "AddApplicationText" hits you in the face when you know what you are looking for. That of course is where you have the advantage, you know what you are talking about. I could have read that 6 times with out the penny dropping.

You wrote that you did not see any "addpermission".
The manifest has the line:
"AddPermission(android.permission.ACCESS_NETWORK_STATE)",
was there a different addpermission that I have missed?

Thanks again
Regards Roger
 
Upvote 0
Top