Search code examples
androidtitaniumtitanium-mobile

Titanium: Signing apk fails


So i click Run, and this is the error i get:

[INFO] :   Determining signature algorithm: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/keytool "-J-Duser.language=en" "-v" "-list" "-keystore" "/Users/johndoe/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/android/dev_keystore" "-storepass" "*******" "-alias" "tidev"
[INFO] :   Using MD5withRSA signature algorithm
[INFO] :   Signing apk: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/jarsigner "-sigalg" "MD5withRSA" "-digestalg" "SHA1" "-keystore" "/Users/johndoe/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/android/dev_keystore" "-storepass" "*******" "-signedjar" "/Users/johndoe/Documents/Titanium_Studio_Workspace/TestApp/build/android/bin/TestApp.apk" "/Users/johndoe/Documents/Titanium_Studio_Workspace/TestApp/build/android/bin/app-unsigned.apk" "tidev"
[ERROR] Application Installer abnormal process termination. Process exit value was 8
[INFO] :   Aligning zip file: null "-v" "4" "/Users/johndoe/Documents/Titanium_Studio_Workspace/TestApp/build/android/bin/TestApp.apk" "/Users/johndoe/Documents/Titanium_Studio_Workspace/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/johndoe/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/node_modules/node-appc/lib/subprocess.js:47:14)
    at AndroidBuilder.<anonymous> (/Users/johndoe/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/android/cli/commands/_build.js:3954:20)
    at /usr/local/lib/node_modules/titanium/lib/hook.js:256:13
    at /usr/local/lib/node_modules/titanium/node_modules/async/li

I tried executing the statement in question manually, but i get the same error.

At first i thought my keystore got corrupted, so i tested that using this:

keytool -list -keystore "/Users/johndoe/Library/Application Support/Titanium/mobilesdk/osx/3.2.2.GA/android/dev_keystore"

I enter password "tirocks", and it lists 1 entry. So it's not a password issue or that the keystore is corrupt.

Anyone have any idea what's going on?


Solution

  • Holy smokes, i solved it, i pulled all my hair out trying to solve it.

    The issue was not with the signing of the apk, but with the next line, with the zipalign tool.

    It was giving me an error message at the start of executing it, but i've been ignoring that message.

    Well finally i decided to deal with it, and it turns out it was the cause of the issue.

    So basically, i copied the zipalign file from the platform-tools (it's in several folders, just search for it) to the /tools folder in your SDK.

    Now it's working!

    And there was much rejoicing...