[TIMOB-27091] Android: App crashes on incremental build in SDK 8.1.0+
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Not Our Bug |
Resolution Date | 2019-06-22T12:53:52.000+0000 |
Affected Version/s | Release 8.1.0 |
Fix Version/s | n/a |
Components | Android |
Labels | n/a |
Reporter | Hans Knöchel |
Assignee | Joshua Quick |
Created | 2019-05-19T15:51:41.000+0000 |
Updated | 2020-08-11T01:34:32.000+0000 |
Description
We recently updated to latest master and noticed that our Android app (tested inside Simulator) sometimes randomly crashes with the following error:
[INFO] Project built successfully in 47s 475ms
[INFO] TiApplication: (main) [164,164] Analytics have been disabled
[INFO] TiApplication: (main) [175,339] Titanium Javascript runtime: v8
[DEBUG] TiAnimationModule: (main) [29,368] inside onAppCreate
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity create, savedInstanceState: null
[INFO] TiRootActivity: (main) [0,0] checkpoint, on root activity resume. activity = io.lambus.app.LambusActivity@e50663d
[ERROR] TiAssetHelper: Error while reading asset "Resources/ti.main.js":
[ERROR] TiAssetHelper: java.io.FileNotFoundException: Resources/ti.main.js
[ERROR] TiAssetHelper: at android.content.res.AssetManager.nativeOpenAsset(Native Method)
[ERROR] TiAssetHelper: at android.content.res.AssetManager.open(AssetManager.java:744)
[ERROR] TiAssetHelper: at android.content.res.AssetManager.open(AssetManager.java:721)
[ERROR] TiAssetHelper: at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:165)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:99)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:466)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:183)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:485)
[ERROR] TiAssetHelper: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)
[ERROR] TiAssetHelper: at android.app.Activity.performResume(Activity.java:7292)
[ERROR] TiAssetHelper: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
[ERROR] TiAssetHelper: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
[ERROR] TiAssetHelper: at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
[ERROR] TiAssetHelper: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
[ERROR] TiAssetHelper: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
[ERROR] TiAssetHelper: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] TiAssetHelper: at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] TiAssetHelper: at android.os.Looper.loop(Looper.java:193)
[ERROR] TiAssetHelper: at android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] TiAssetHelper: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiAssetHelper: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] TiAssetHelper: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[ERROR] TiAssetHelper: Error while reading asset "Resources/ti.main.js":
[ERROR] TiAssetHelper: java.io.FileNotFoundException: Resources/ti.main.js
[ERROR] TiAssetHelper: at android.content.res.AssetManager.nativeOpenAsset(Native Method)
[ERROR] TiAssetHelper: at android.content.res.AssetManager.open(AssetManager.java:744)
[ERROR] TiAssetHelper: at android.content.res.AssetManager.open(AssetManager.java:721)
[ERROR] TiAssetHelper: at org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:165)
[ERROR] TiAssetHelper: at org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)
[ERROR] TiAssetHelper: at org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:162)
[ERROR] TiAssetHelper: at org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:207)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:99)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:466)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:183)
[ERROR] TiAssetHelper: at org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:485)
[ERROR] TiAssetHelper: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)
[ERROR] TiAssetHelper: at android.app.Activity.performResume(Activity.java:7292)
[ERROR] TiAssetHelper: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3776)
[ERROR] TiAssetHelper: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3816)
[ERROR] TiAssetHelper: at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
[ERROR] TiAssetHelper: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
[ERROR] TiAssetHelper: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
[ERROR] TiAssetHelper: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1808)
[ERROR] TiAssetHelper: at android.os.Handler.dispatchMessage(Handler.java:106)
[ERROR] TiAssetHelper: at android.os.Looper.loop(Looper.java:193)
[ERROR] TiAssetHelper: at android.app.ActivityThread.main(ActivityThread.java:6669)
[ERROR] TiAssetHelper: at java.lang.reflect.Method.invoke(Native Method)
[ERROR] TiAssetHelper: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
[ERROR] TiAssetHelper: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)
[ERROR] v8:
[ERROR] v8:
[ERROR] v8: #
[ERROR] v8: # Fatal error in , line 0
[ERROR] v8: #
[ERROR] v8: unreachable code
[ERROR] v8:
[ERROR] v8: #
[ERROR] v8: #
[ERROR] v8: #
[ERROR] v8: #FailureMessage Object: 0xffd60bb0
We have no idea how to workaround this right now.
[~jquick] [~gmathews] Quick ping so this does not slip into 8.1.0.GA
This may be due to javascript assets not being copied correctly during build. I have a suspicion that VSCode's file watcher may be causing this issue?
I suspect it being a regression from the V8 snapshot API we applied to our fork. The whole build works fine but then crashes on the launch, even if no file changed if i recall that correctly
I'm unable to reproduce this issue. I've tried building your Lambus app to the Android emulator multiple times via command line...
appc run -p android
As well as via LiveView via the below...appc run -p android --liveview
I'm curious if a VS Code plugin you are using (perhaps ours?) might be wrongly locking files randomly under the project's "build" directory. If you close VS Code and build via the command line, then does the issue go away? I've built your Lambus app while VS Code had the whole app project folder opened. I even selected the "ti.main.js" file under the "build" directory and did a build via the command line. The incremental build was working fine for me. Although the only plugin I have installed is ESLint at the moment.I've also tried incremental builds to the Android emulator with VS Code and our Titanium plugin installed. I still can't reproduce this issue. Hmm...
[~hknoechel], try quitting out of VS Code and then do multiple builds. This is to prove that VS Code is locking files and is the root cause of the build issues. If closing VS Code *does* solve the issue, then it sounds like the solution is to tell VS Code to ignore your project's "build" and "Resources" directory. You can do that by creating the following directory and file under your project... _
When you re-open your project in VS Code, the "build" and "Resources" directory will no longer appear under the VS Code's "Explorer" panel. This means it'll no longer monitor for file changes there, which might be locking files. *Side Note:* For everyone else reading this, ignoring the "Resources" directory only makes sense for Alloy projects. You would never want to do this for a Classic app project.
This is not an issue anymore.