Android Question GetAllSafeDirsExternal("") crash

mw71

Active Member
Licensed User
Longtime User
hi

i use this code Line to get the Path for internal and external SD Card.
B4X:
Dim pfade() As String = Starter.rp.GetAllSafeDirsExternal("")
(Starter -> Starter Service
rp -> RunntimePermission, Public rp As RuntimePermissions)

Until now it works fine.

Now my Device (Motorola One... with Android 9) has a problem with the external SD Card (internal all o.k.) and the code line crash.
I do not understand why.

(java line 2544 points to the codeline above)
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:121)
at de.soft.myapp.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.soft.myapp.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.soft.myapp.main.afterFirstLayout(main.java:104)
at de.soft.myapp.main.access$000(main.java:17)
at de.soft.myapp.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:121)
at de.soft.myapp.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.soft.myapp.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.soft.myapp.main.afterFirstLayout(main.java:104)
at de.soft.myapp.main.access$000(main.java:17)
at de.soft.myapp.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
 

mw71

Active Member
Licensed User
Longtime User
sri, i have forget to update B4A

Update now to latest Release (9.8), the same error.
(Beta not testet)
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
What changed when you started to get this error?

Did you update the OS on your phone?

Did you replace the SD card in your phone?
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
hi

No Update.

No realy Change.
Now i see and test, with SD Card Inside, but unmount (press eject in the OS) i get the Error.
With mount RO (i think it's RO, i can see/open all, also the SQLite Database?, but no write posibble) the Error don't come.
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
hi,

i think there is no change in in the Error before/after update B4A.
I have attach the unfilter Log.
Failed to openat(/storage/413B-1E1A): Permission denied
Failed to ensure /storage/413B-1E1A/Android/data/de.mysoft.mylog/files: java.lang.IllegalStateException: Failed to prepare /storage/413B-1E1A/Android/data/de.mysoft.mylog/files/: android.os.ServiceSpecificException: (code -13)
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:121)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
A resource failed to call close.
MM Stop accel
Compiler allocated 4MB to compile java.lang.String de.mysoft.mylog.main._set_loc()
Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String. The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1302)
at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1076)
at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:7570)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:10415)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1735)
at android.app.ContextImpl.startActivity(ContextImpl.java:920)
at android.app.ContextImpl.startActivity(ContextImpl.java:891)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:863)
at de.mysoft.mylog.starter._application_error(starter.java:257)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1083)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1046)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleUncaughtException(ServiceHelper.java:267)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:222)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
START u0 {act=android.intent.action.SEND_MULTIPLE typ=text/plain flg=0x10000000 cmp=android/com.android.internal.app.ResolverActivity (has extras)} from uid 10257
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:121)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
--------- beginning of crash
FATAL EXCEPTION: main
Process: de.mysoft.mylog, PID: 10976
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:121)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
 
Upvote 0

mw71

Active Member
Licensed User
Longtime User
with RuntimePermissions V1.11

Failed to openat(/storage/413B-1E1A): Permission denied
Failed to ensure /storage/413B-1E1A/Android/data/de.mysoft.mylog/files: java.lang.IllegalStateException: Failed to prepare /storage/413B-1E1A/Android/data/de.mysoft.mylog/files/: android.os.ServiceSpecificException: (code -13)
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:138)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Slow dispatch took 1427ms main h=android.app.ActivityThread$H c=android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA@565be51 m=0
DefaultDialerCache: Refreshing default dialer for user 0: now com.google.android.dialer: DDC.oR@AVs
getFullBackupIntervalMilliseconds(...) returns 86400000
Drained
Indexing com.google.android.gms-apps from com.google.android.gms [CONTEXT service_id=21 ]
Indexing done com.google.android.gms-apps [CONTEXT service_id=21 ]
resources.arsc in APK '/data/app/com.instagram.android-xxQEgV7WbfB0bioYyc1LDQ==/base.apk' is compressed.
Key android.intent.extra.TEXT expected ArrayList<CharSequence> but value was a java.lang.String. The default value <null> was returned.
Attempt to cast generated internal exception:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.ArrayList
at android.os.BaseBundle.getCharSequenceArrayList(BaseBundle.java:1302)
at android.os.Bundle.getCharSequenceArrayList(Bundle.java:1076)
at android.content.Intent.getCharSequenceArrayListExtra(Intent.java:7570)
at android.content.Intent.migrateExtraStreamToClipData(Intent.java:10415)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1735)
at android.app.ContextImpl.startActivity(ContextImpl.java:920)
at android.app.ContextImpl.startActivity(ContextImpl.java:891)
at android.content.ContextWrapper.startActivity(ContextWrapper.java:379)
at anywheresoftware.b4a.keywords.Common.StartActivity(Common.java:863)
at de.mysoft.mylog.starter._application_error(starter.java:257)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.keywords.Common.CallSub4(Common.java:1083)
at anywheresoftware.b4a.keywords.Common.CallSubNew3(Common.java:1046)
at anywheresoftware.b4a.objects.ServiceHelper$StarterHelper.handleUncaughtException(ServiceHelper.java:267)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:222)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
START u0 {act=android.intent.action.SEND_MULTIPLE typ=text/plain flg=0x10000000 cmp=android/com.android.internal.app.ResolverActivity (has extras)} from uid 10257
main$ResumableSub_Activity_Createresume (java line: 2544)
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:138)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
--------- beginning of crash
FATAL EXCEPTION: main
Process: de.mysoft.mylog, PID: 18859
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.io.File.toString()' on a null object reference
at anywheresoftware.b4a.objects.RuntimePermissions.GetAllSafeDirsExternal(RuntimePermissions.java:138)
at de.mysoft.mylog.main$ResumableSub_Activity_Create.resume(main.java:2544)
at de.mysoft.mylog.main._activity_create(main.java:1349)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at de.mysoft.mylog.main.afterFirstLayout(main.java:104)
at de.mysoft.mylog.main.access$000(main.java:17)
at de.mysoft.mylog.main$WaitForLayout.run(main.java:82)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:220)
at android.app.ActivityThread.main(ActivityThread.java:6939)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
 
Upvote 0
Top