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 **
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)
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)
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.
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.
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
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.