Android Question No debug error - beginning of crash, but Release Works

mcqueccu

Well-Known Member
Licensed User
Longtime User
I have this application I want to update. When I tried running the last stable version in RELEASE mode, it compiles and runs fine. But when I switch to DEBUG Mode, It just shows like it's about to run, then suddenly stops with no crash log. At times shows "------beginning of crash" but nothing follows.

B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **

Libraries
1663746798435.png
 

Spavlyuk

Active Member
Licensed User
Does the debug toolbar appear after compilation ends? Sometimes I have an issue where it does not appear and I need to restart Windows to fix it.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
Have you checked the unfiltered logs?

I get this from the unfiltered logs. Java.io.FileNotFoundException.

I can physically confirm the file exist in the files folder and in the DirAssets.
I clicked sync several times but still same error.

B4X:
LottieViewHearts.Initialize("")
    pnlBeatingHeart.AddView(LottieViewHearts,0,0,pnlBeatingHeart.Width,pnlBeatingHeart.Height)
   
    Dim Drawable As AXrLottieDrawableBuilder
    Drawable.InitializeFromFile(File.DirAssets,"loading-hearts.json") _
                .SetAutoRepeat(Drawable.AUTO_REPEAT_INFINITE) _
                .SetAutoStart(True) _
                .SetCacheEnabled(False)
    LottieViewHearts.SetLottieDrawable(Drawable.Build)

1663819988192.png


1663820103626.png


B4X:
java.io.FileNotFoundException: loading_hearts.json
    at android.content.res.AssetManager.nativeOpenAsset(Native Method)
    at android.content.res.AssetManager.open(AssetManager.java:744)
    at android.content.res.AssetManager.open(AssetManager.java:721)
    at com.aghajari.rlottie.AXrLottieDrawable.readRes(AXrLottieDrawable.java:1178)
    at com.aghajari.rlottie.AXrLottieDrawable.fromAssets(AXrLottieDrawable.java:1250)
    at com.aghajari.axrlottie.AXrLottieDrawableBuilder.InitializeFromFile(AXrLottieDrawableBuilder.java:20)
    at com.leafecodes.lovematch.main._activity_create(main.java:455)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
    at java.lang.reflect.Method.invoke(Native Method)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:146)
    at com.leafecodes.lovematch.main.afterFirstLayout(main.java:105)
    at com.leafecodes.lovematch.main.access$000(main.java:17)
    at com.leafecodes.lovematch.main$WaitForLayout.run(main.java:83)
    at android.os.Handler.handleCallback(Handler.java:873)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:6730)
    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:860)
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
When I copied the files to the Dirinternal first, it works. I think there is a problem with the Lottie loading files from DirAssets


This Works:
File.Copy(File.DirAssets,"loading_hearts.json",File.DirInternal,"loading_hearts.json")
Drawable.InitializeFromFile(File.DirInternal,"loading-hearts.json")
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
In debug mode the assets files are loaded from a "virtual" assets folders. This allows the IDE to make all kinds of optimizations.
It does require libraries to access the files using the B4A files methods.

You can disable this feature with:
B4X:
#DebuggerForceStandardAssets: true
In the main module.
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
It looks like you were trying to load "loading-hearts.json" when in the assets it was "loading_hearts.json". You've probably corrected that by copying now.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
It looks like you were trying to load "loading-hearts.json" when in the assets it was "loading_hearts.json".
look at the error. there is no - inside the filename. And even not in his Assets.
loading_hearts.json

The problem is that Lottie can not read Files from a B4A Assets which is a virtual path.
Solution is to copy the file to DirInternal first and let Lottie load them from there or to use
B4X:
#DebuggerForceStandardAssets: true
 
Upvote 0

stevel05

Expert
Licensed User
Longtime User
no - inside the filename. And even not in his Assets.
I was looking at the code that was posted:
B4X:
Drawable.InitializeFromFile(File.DirAssets,"loading-hearts.json") _

But it's gone past that and now solved, so all is good.
 
Upvote 0

mcqueccu

Well-Known Member
Licensed User
Longtime User
I was looking at the code that was posted:
B4X:
Drawable.InitializeFromFile(File.DirAssets,"loading-hearts.json") _

But it's gone past that and now solved, so all is good.

The file names were correct at the time I was testing. As you know the IDE will even underline if the filename you specify does not exist in the files tab.
Sorry, I posted a different "Test Try and Error Response". I tried both the Underscore and Dash and No Dash/space just to be sure the error wasn't coming from that.
 
Upvote 0
Top