Android Question Image files not loaded in webviews in Debug Mode

leongcc

Member
Licensed User
Longtime User
Webviews are not able to load images stored in the asset directory when in Debug Mode. So I
I added #DebuggerForceStandardAssets: true in the main Activity, but this cause an error at Activity.LoadLayout(mainmt.bal): compiler cannot find the layout file. In Release Mode, everything works fine.
Is there a directory I can copy those image files so that they are loaded during debugging ?

Using B4A 5.80.

This is the error log :
B4X:
Error occurred on line: 372 (Main)
java.io.FileNotFoundException: mainmt.bal
    at android.content.res.AssetManager.openAsset(Native Method)
    at android.content.res.AssetManager.open(AssetManager.java:324)
    at android.content.res.AssetManager.open(AssetManager.java:298)
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:202)
    at anywheresoftware.b4a.keywords.LayoutBuilder.loadLayout(LayoutBuilder.java:78)
    at anywheresoftware.b4a.objects.ActivityWrapper.LoadLayout(ActivityWrapper.java:208)
    at com.packagename.main._activity_create(main.java:603)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:702)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:339)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:246)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:511)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:134)
    at com.packagename.main.afterFirstLayout(main.java:102)
    at com.packagename.main.access$000(main.java:17)
    at com.packagename.main$WaitForLayout.run(main.java:80)
    at android.os.Handler.handleCallback(Handler.java:725)
    at android.os.Handler.dispatchMessage(Handler.java:92)
    at android.os.Looper.loop(Looper.java:153)
    at android.app.ActivityThread.main(ActivityThread.java:5356)
    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:853)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
    at dalvik.system.NativeStart.main(Native Method)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0

leongcc

Member
Licensed User
Longtime User
Yes, mainmt.bal is already added in the File Manager.
I am aware of WebViewAssetFile, but it is going to be very complicated to use it my javascripts.
Just for my debugging purpose, is there a temporary way to make the compiler find my layout file if not the image files ?
 
Upvote 0

leongcc

Member
Licensed User
Longtime User
It would take more time to strip down my project to run at your site.
So I went ahead and apply WebViewAssetFile to my javascripts and it works of course.

Still unresolved is the layout file-not-found error when #DebuggerForceStandardAssets: true in Debug Mode.
Thanks
 
Upvote 0
Top