{ "id": "173727", "key": "TIMOB-27135", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2019-11-05T20:22:14.000+0000", "created": "2019-06-05T22:53:53.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "android", "build", "engSchedule", "regression" ], "versions": [ { "id": "20412", "name": "Release 8.1.0", "archived": false, "released": true, "releaseDate": "2019-08-13" } ], "issuelinks": [ { "id": "57693", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "173769", "key": "TIMOB-27160", "fields": { "summary": "Android: Integrate incremental build workarounds to task", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "None", "id": "6" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "57679", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "173558", "key": "TIMOB-27043", "fields": { "summary": "Cache JS processing between builds", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Medium", "id": "3" }, "issuetype": { "id": "4", "description": "An improvement or enhancement to an existing feature or task.", "name": "Improvement", "subtask": false } } } } ], "assignee": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2019-11-05T20:22:18.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "*Summary:*\r\nThe changes made by [TIMOB-27043] is causing Android build issues as of 8.1.0.\r\nNote that this issue was never released. We've caught it before RC.\r\n\r\n----\r\n*Issue 1:*\r\nBuilding an Android project with asset encryption enabled (which \"device\" and \"production\" builds do by default) will fail when built the 2nd time.\r\n\r\nTo reproduce, run the below command on a project twice. It'll fail on the 2nd attempt.\r\n{code}\r\nappc run -p android --build-only --deploy-type test\r\n{code}\r\n\r\nThe above will typically fail on the 2nd attempt with...\r\n{code}\r\n[ERROR] : Failed to compile Java source files:\r\n[ERROR] : \r\n[ERROR] : /Users/lchoudhary/Desktop/workspaces/workspace_2019/kitchensink-v2-master/build/android/gen/com/appcelerator/kitchensink/KitchensinkApplication.java:40: error: cannot find symbol\r\n[ERROR] : \t\tKrollAssetHelper.setAssetCrypt(new AssetCryptImpl());\r\n[ERROR] : \t\t ^\r\n[ERROR] : symbol: class AssetCryptImpl\r\n[ERROR] : location: class KitchensinkApplication\r\n[ERROR] : Note: /Users/lchoudhary/Desktop/workspaces/workspace_2019/kitchensink-v2-master/build/android/gen/com/appcelerator/kitchensink/KitchensinkApplication.java uses unchecked or unsafe operations.\r\n[ERROR] : Note: Recompile with -Xlint:unchecked for details.\r\n[ERROR] : 1 error\r\n[ERROR] Application Installer abnormal process termination. Process exit value was 1\r\n{code}\r\n\r\n----\r\n*Issue 2:*\r\nA local HTML file that references a JavaScript file via the {{\r\n\t\r\n\t\r\n\t\tThis verifies that a local HTML file can access a local JS file.\r\n\t\r\n\r\n{code}\r\n\r\n_myHtmlScript.js_\r\n{code:javascript}\r\nfunction onPageLoaded() {\r\n\talert(\"Embedded script successfully accessed via HTML file.\");\r\n}\r\n{code}\r\n\\\\\r\n\\\\\r\nThe above will cause the following build failure...\r\n{code}\r\n[ERROR] :  TypeError: Cannot read property 'cyan' of undefined\r\n    at AndroidBuilder.copyFile (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2352:53)\r\n    at AndroidBuilder.next (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2711:16)\r\n    at /Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3880:24\r\n    at eachOfArrayLike (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:1069:9)\r\n    at eachOf (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:1117:5)\r\n    at _parallel (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3879:5)\r\n    at Object.parallelLimit [as parallel] (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3962:5)\r\n    at Object.parallel (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/node-appc/lib/async.js:56:8)\r\n    at task.run.then (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2707:16)\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: Broken incremental builds when using encrypted assets or referencing JS from HTML", "creator": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "gmathews", "key": "gmathews", "displayName": "Gary Mathews", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "closedSprints": [ { "id": 1141, "state": "closed", "name": "2019 Sprint 12", "startDate": "2019-06-03T22:00:37.435Z", "endDate": "2019-06-14T22:00:00.000Z", "completeDate": "2019-06-15T03:44:20.826Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "448883", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10945", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-06T04:10:58.000+0000", "updated": "2019-06-06T04:10:58.000+0000" }, { "id": "448912", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "^ The above PR doesn't fully fix the incremental \"device\" build.\r\n\r\nAfter editing a JS file and rebuilding, I sometimes get the following app build error...\r\n{code}\r\n[ERROR] Failed to compile Java source files:\r\n[ERROR] \r\n[ERROR] /Users/jquick2/Documents/Appcelerator_Studio_Workspace/ClassicAppTest/build/android/gen/com/appcelerator/testing/AssetCryptImpl.java:58: error: cannot find symbol\r\n[ERROR] \treturn assets.keySet();\r\n[ERROR] \t ^\r\n[ERROR] symbol: variable assets\r\n[ERROR] location: class AssetCryptImpl\r\n[ERROR] /Users/jquick2/Documents/Appcelerator_Studio_Workspace/ClassicAppTest/build/android/gen/com/appcelerator/testing/AssetCryptImpl.java:74: error: cannot find symbol\r\n[ERROR] \tRange range = assets.get(path);\r\n[ERROR] \t ^\r\n[ERROR] symbol: variable assets\r\n[ERROR] location: class AssetCryptImpl\r\n[ERROR] /Users/jquick2/Documents/Appcelerator_Studio_Workspace/ClassicAppTest/build/android/gen/com/appcelerator/testing/AssetCryptImpl.java:79: error: cannot find symbol\r\n[ERROR] \treturn filterDataInRange(assetsBytes, range.offset, range.length);\r\n[ERROR] \t ^\r\n[ERROR] symbol: variable assetsBytes\r\n[ERROR] location: class AssetCryptImpl\r\n[ERROR] Note: /Users/jquick2/Documents/Appcelerator_Studio_Workspace/ClassicAppTest/build/android/gen/com/appcelerator/testing/AssetCryptImpl.java uses unchecked or unsafe operations.\r\n[ERROR] Note: Recompile with -Xlint:unchecked for details.\r\n[ERROR] 3 errors\r\n{code}\r\n\r\nAnd after doing another rebuild after the above happens the app will successfully build, but upon app launch on device, the app will crash on startup with the following logged error. Looking under the \"build\" directory \"gen\" folder, I can see that the \"AssetCryptImpl.java\" file that was generated is missing all of the encrypted JS files.\r\n{code}\r\n[ERROR] TiAssetHelper: Error while reading asset \"Resources/ti.main.js\":\r\n[ERROR] TiAssetHelper: java.io.FileNotFoundException: Resources/ti.main.js\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.nativeOpenAsset(Native Method)\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.open(AssetManager.java:744)\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.open(AssetManager.java:721)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:165)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:99)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:466)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:183)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:485)\r\n[ERROR] TiAssetHelper: \tat android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)\r\n[ERROR] TiAssetHelper: \tat android.app.Activity.performResume(Activity.java:7300)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.performResumeActivity(ActivityThread.java:3777)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3817)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)\r\n[ERROR] TiAssetHelper: \tat android.os.Handler.dispatchMessage(Handler.java:106)\r\n[ERROR] TiAssetHelper: \tat android.os.Looper.loop(Looper.java:193)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.main(ActivityThread.java:6680)\r\n[ERROR] TiAssetHelper: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] TiAssetHelper: \tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\r\n[ERROR] TiAssetHelper: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)\r\n[ERROR] TiAssetHelper: Error while reading asset \"Resources/ti.main.js\":\r\n[ERROR] TiAssetHelper: java.io.FileNotFoundException: Resources/ti.main.js\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.nativeOpenAsset(Native Method)\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.open(AssetManager.java:744)\r\n[ERROR] TiAssetHelper: \tat android.content.res.AssetManager.open(AssetManager.java:721)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.kroll.util.KrollAssetHelper.readAsset(KrollAssetHelper.java:165)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.kroll.runtime.v8.V8Runtime.nativeRunModule(Native Method)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.kroll.runtime.v8.V8Runtime.doRunModule(V8Runtime.java:162)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.kroll.KrollRuntime.runModule(KrollRuntime.java:207)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiLaunchActivity.loadScript(TiLaunchActivity.java:99)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiRootActivity.loadScript(TiRootActivity.java:466)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiLaunchActivity.onResume(TiLaunchActivity.java:183)\r\n[ERROR] TiAssetHelper: \tat org.appcelerator.titanium.TiRootActivity.onResume(TiRootActivity.java:485)\r\n[ERROR] TiAssetHelper: \tat android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1412)\r\n[ERROR] TiAssetHelper: \tat android.app.Activity.performResume(Activity.java:7300)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.performResumeActivity(ActivityThread.java:3777)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3817)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)\r\n[ERROR] TiAssetHelper: \tat android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread$H.handleMessage(ActivityThread.java:1809)\r\n[ERROR] TiAssetHelper: \tat android.os.Handler.dispatchMessage(Handler.java:106)\r\n[ERROR] TiAssetHelper: \tat android.os.Looper.loop(Looper.java:193)\r\n[ERROR] TiAssetHelper: \tat android.app.ActivityThread.main(ActivityThread.java:6680)\r\n[ERROR] TiAssetHelper: \tat java.lang.reflect.Method.invoke(Native Method)\r\n[ERROR] TiAssetHelper: \tat com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)\r\n[ERROR] TiAssetHelper: \tat com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)\r\n{code}\r\n", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-07T01:53:32.000+0000", "updated": "2019-06-07T01:53:32.000+0000" }, { "id": "448941", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "The above issue happened because the \"forceRebuild\" flag was set which deleted the \"assets\" directory that once contained the JS files, but the new incremental build system does not check for output file existence and thus proceeded to build the APK containing zero JS files. Ideally, the new [process-js-task.js|https://github.com/appcelerator/titanium_mobile/blob/master/cli/lib/tasks/process-js-task.js] code that tracks incremental build changes should also verify that the output file exists as well, which would add some overhead, but would avoid issues like this.\r\n\r\nIn the meantime, a quick solution in the Android \"_build.js\" is to delete the \"incremental\" build directory when the \"forceRebuild\" flag is set. This way the system will start with a clean slate. I've changed the PR to do exactly this and the problem is now solved.", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-08T08:12:28.000+0000", "updated": "2019-06-08T08:12:28.000+0000" }, { "id": "448999", "author": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR (master): https://github.com/appcelerator/titanium_mobile/pull/10945\r\nPR (8.1.x): https://github.com/appcelerator/titanium_mobile/pull/10958", "updateAuthor": { "name": "jquick", "key": "jquick", "displayName": "Joshua Quick", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2019-06-11T19:32:47.000+0000", "updated": "2019-06-11T19:33:30.000+0000" }, { "id": "449007", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "FR Passed .Waiting on Jenkins.", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-06-11T22:02:07.000+0000", "updated": "2019-06-11T22:02:07.000+0000" }, { "id": "449043", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR merged", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-06-12T22:54:04.000+0000", "updated": "2019-06-12T22:54:04.000+0000" }, { "id": "449066", "author": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Verified the Fix on SDK 8.2.0.v20190612155743 and 8.1.0.v20190612160220.Works as expected. No errors displayed on launching app. Closing.\r\n{code}\r\nName = Mac OS X\r\n Version = 10.13.6\r\n Architecture = 64bit\r\n # CPUs = 8\r\n Memory = 17179869184\r\nNode.js\r\n Node.js Version = 10.13.0\r\n npm Version = 6.4.1\r\nTitanium CLI\r\n CLI Version = 5.1.1\r\nTitanium SDK\r\n SDK Version = sdk 8.1.0.v20190612160220 and 8.2.0.v20190612155743\r\nDevice =Nexus android 5,Oneplus 5t android 9\r\n{code}", "updateAuthor": { "name": "kmahalingam", "key": "kmahalingam", "displayName": "Keerthi Mahalingam", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2019-06-13T17:56:17.000+0000", "updated": "2019-06-13T17:56:17.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }