[TIMOB-17221] Android: Android SDK tools update to rev23 breaks build as it can't find tool zipalign
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2014-06-27T21:22:59.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 3.3.0 |
Components | Android |
Labels | module_cli, qe-3.3.0, qe-testadded |
Reporter | Lokesh Choudhary |
Assignee | Chris Barber |
Created | 2014-06-26T17:59:08.000+0000 |
Updated | 2016-09-28T21:42:27.000+0000 |
Description
H5.Description:
1. Update the Android SDK tools to rev23
2. Create an classic/alloy app.
3. Build it for android device/emulator.
Actual Result:
1. At the beginning of the logs we get error logs as it can't find the zipalign tool:
[ERROR] : Unable to find Android SDK tools: zipalign.
[ERROR] : You have an incomplete or out-of-date installation.
[ERROR] : Verify your Android SDK packages or reinstall the Android SDK by running 'titanium setup android' or manually downloading from http://appcelerator.com/android-sdk.
2. The build process continues & fails giving following errors later:
[INFO] : Aligning zip file: null "-v" "4" "/Users/lokeshchoudhary/Desktop/workspaces/comerica_workspcae/testapp/build/android/bin/testapp.apk" "/Users/lokeshchoudhary/Desktop/workspaces/comerica_workspcae/testapp/build/android/bin/testapp.apkz"
/usr/local/lib/node_modules/titanium/node_modules/longjohn/dist/longjohn.js:185
throw e;
^
TypeError: Bad argument
at ChildProcess.spawn (child_process.js:915:24)
at exports.spawn (child_process.js:715:9)
at Object.run (/Users/lokeshchoudhary/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140625133319/node_modules/node-appc/lib/subprocess.js:47:14)
at AndroidBuilder.<anonymous> (/Users/lokeshchoudhary/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140625133319/android/cli/commands/_build.js:4126:20)
at /usr/local/lib/node_modules/titanium/lib/hook.js:256:13
at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:232:13
at async.eachSeries (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:130:20)
at _asyncMap (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:226:9)
at Object.mapSeries (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:216:23)
at async.series (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:549:19)
---------------------------------------------
at Object.run (/Users/lokeshchoudhary/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140625133319/node_modules/node-appc/lib/subprocess.js:59:8)
at AndroidBuilder.<anonymous> (/Users/lokeshchoudhary/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140625133319/android/cli/commands/_build.js:4103:20)
at /usr/local/lib/node_modules/titanium/lib/hook.js:256:13
at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:232:13
at async.eachSeries (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:130:20)
at _asyncMap (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:226:9)
at Object.mapSeries (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:216:23)
at async.series (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:549:19)
[ERROR] Application Installer abnormal process termination. Process exit value was 8
Workarounds which can be used in this case & works: There are 2 workarounds:
1. Create "android.executables.zipalign" flag in ti.config:
Create a "android.executables.zipalign" ti.config flag in CLI & set it to the path for zipalign. The new path for the zipalign tools is "android-sdk-folder/build-tools/19.1.0/zipalign". Make sure you include tool name zipalign in the path.2. Copy zipalign from "build tools/19.0.1" to "tools" folder:
Copy & paste the zipalign tool from "android-sdk-folder/build-tools/19.1.0" to "tools" folder.Titanium SDK master pull request: https://github.com/appcelerator/titanium_mobile/pull/5856 Titanium SDK 3_3_X pull request: https://github.com/appcelerator/titanium_mobile/pull/5857 Titanium CLI master pull request: https://github.com/appcelerator/titanium/pull/146 Titanium CLI 3_3_X pull request: https://github.com/appcelerator/titanium/pull/147 To test: 1) update to latest Android build/sdk/platform tools 2) run "ti info -t android -o json" and verify it found zipalign 3) run "ti setup check" to make sure the Android tools are good to go 4) build any android app
Issue is still reproducible using the following Environment: Tested on: Device : Google Nexus 7, Android Version: 4.4.4 SDK: 3.3.0.v20140626144112 CLI version : 3.3.0-rc2 OS : Windows 8.1 Alloy: 1.4.0-rc2 ACS: 1.0.15 npm:1.3.2 LiveView: 1.0.4 Appcelerator Studio, build: 3.3.0.201406231625 titanium-code-processor: 1.1.1
[~pmishra] That's because the fix is still in review. The fix has not been merged yet and this ticket has not been resolved yet.
If you update to android SDK tools ver23 & do not update build tools to ver19.1 or ver20 but stay at 19.0.3 , you will no longer have zipalign. This is because previously the zipalign tool was placed inside the tools folder but with the update to ver23 it is placed inside folder "build tools/build tools version folder" e.g 19.1.0 or 20.0.0 etc. Then if do not update your sdk build tools then the zipalign will be removed from tools folder after android SDK tools update to rev23, leaving you with no zipalign. In this case, you won't be able to use the workaround mentioned above as there will no zipalign present. You will need to update the android build tools to ver19.1 or ver20 to keep zipalign.
With r23 SDK and r19 build tools installed, I get the new multi-line error message as expected. With r23 and r20 build tools, zipalign is found and info and build commands work as expected. Passes.
Verified the fix.
1. Updated to latest Android build/sdk/platform tools.
2. Ran "ti info -t android -o json":
Did not give me any errors related to zipalign.3. Ran "ti setup check":
Command detected the new android tools & found the zipalign inside its new location.4. Built an android app:
Built an android app for android device/emulator & the app installed & launched successfully without any errors. Closing. Environment: Appc Studio : 3.3.0.201406271159 Ti SDK : 3.3.0.v20140627202512 Mac OSX : 10.8.5 Alloy : 1.4.0-rc2 CLI - 3.3.0-rc4 Code Processor: 1.1.1 Nexus 5 - android 4.4.4