Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-27135

Android: Broken incremental builds when using encrypted assets or referencing JS from HTML

    Details

    • Story Points:
      5
    • Sprint:
      2019 Sprint 12

      Description

      Summary:
      The changes made by TIMOB-27043 is causing Android build issues as of 8.1.0.
      Note that this issue was never released. We've caught it before RC.


      Issue 1:
      Building an Android project with asset encryption enabled (which "device" and "production" builds do by default) will fail when built the 2nd time.

      To reproduce, run the below command on a project twice. It'll fail on the 2nd attempt.

      appc run -p android --build-only --deploy-type test
      

      The above will typically fail on the 2nd attempt with...

      [ERROR] :  Failed to compile Java source files:
      [ERROR] :  
      [ERROR] :  /Users/lchoudhary/Desktop/workspaces/workspace_2019/kitchensink-v2-master/build/android/gen/com/appcelerator/kitchensink/KitchensinkApplication.java:40: error: cannot find symbol
      [ERROR] :  		KrollAssetHelper.setAssetCrypt(new AssetCryptImpl());
      [ERROR] :  		                                   ^
      [ERROR] :    symbol:   class AssetCryptImpl
      [ERROR] :    location: class KitchensinkApplication
      [ERROR] :  Note: /Users/lchoudhary/Desktop/workspaces/workspace_2019/kitchensink-v2-master/build/android/gen/com/appcelerator/kitchensink/KitchensinkApplication.java uses unchecked or unsafe operations.
      [ERROR] :  Note: Recompile with -Xlint:unchecked for details.
      [ERROR] :  1 error
      [ERROR] Application Installer abnormal process termination. Process exit value was 1
      


      Issue 2:
      A local HTML file that references a JavaScript file via the <script/> tag will cause an immediate build failure.

      Steps to reproduce:

      1. Copy the below files to a Classic app.
      2. Build to an Android device or emulator.
      3. Note that the build will immediately fail.

      app.js

      var window = Ti.UI.createWindow();
      window.add(Ti.UI.createWebView({
      	url: "my.html",
      }));
      window.open();
      

      my.html

      <!DOCTYPE html>
      <html>
      	<head>
      		<script src="myHtmlScript.js"></script>
      	</head>
      	<body onload="onPageLoaded();">
      		This verifies that a local HTML file can access a local JS file.
      	</body>
      </html>
      

      myHtmlScript.js

      function onPageLoaded() {
      	alert("Embedded script successfully accessed via HTML file.");
      }
      



      The above will cause the following build failure...

      [ERROR] :  TypeError: Cannot read property 'cyan' of undefined
          at AndroidBuilder.copyFile (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2352:53)
          at AndroidBuilder.next (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2711:16)
          at /Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3880:24
          at eachOfArrayLike (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:1069:9)
          at eachOf (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:1117:5)
          at _parallel (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3879:5)
          at Object.parallelLimit [as parallel] (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/async/dist/async.js:3962:5)
          at Object.parallel (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/node_modules/node-appc/lib/async.js:56:8)
          at task.run.then (/Users/jquick2/Library/Application Support/Titanium/mobilesdk/osx/8.2.0/android/cli/commands/_build.js:2707:16)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                jquick Joshua Quick
                Reporter:
                gmathews Gary Mathews
                Reviewer:
                Gary Mathews
                Tester:
                Keerthi Mahalingam (Inactive)
              • Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration