Android build failed / Error code: 256

Anyone seen this?  Can’t build for Android…  :(

I was using the latest daily build…  couldn’t get past the error, even ensuring my Android SDK was up to date.  Reverted back to the public build and it’s working now.

I just did a build for Android with 2751 on a Mac and it built fine.

Can you tell us more about your setup?

Any more errors in your console log?

Rob

I got the ‘Error code: 256’ when building for Android today.

It turned out the error was thrown because I had added android push icons but some of the required icons were missing… as described in this thread: https://forums.coronalabs.com/topic/58954-push-notification-icons-android/

I’m getting this error now on build 2806.

From the log…

Jan 29 11:45:22.303 BUILD FAILED

Jan 29 11:45:22.304 /Applications/CoronaSDK-2806/Corona Simulator.app/Contents/Resources/build.xml:429: The following error occurred while executing this line:

Jan 29 11:45:22.304 /Applications/CoronaSDK-2806/Corona Simulator.app/Contents/Resources/build.xml:407: jarsigner returned: 1

Jan 29 11:45:22.304

Jan 29 11:45:22.304 Total time: 5 seconds

Jan 29 11:45:22.344 Android build failed (256)

Are you still getting this error?

Do you get it if you build the Hello World sample app?

Rob

I just tried to build HelloWorld and got the output below. Note that the first time I tried to build today I got the dialog warning about a lack of Java SDK, so I installed it. After that I got further - to the point where the 256 errors are occuring.

Jan 29 01:43:27.405 Using java version “1.8.0_71”
Java™ SE Runtime Environment (build 1.8.0_71-b15)
Java HotSpot™ 64-Bit Server VM (build 25.71-b15, mixed mode)

Jan 29 01:43:27.474 Picked up JAVA_TOOL_OPTIONS: -Duser.language=en

Jan 29 01:43:34.430 Building android app for nathan@beermogul.com with 2016.2806

Jan 29 01:43:37.449 Using custom build id from app bundle: 00000 (AppSettings.lua)

Jan 29 01:43:38.418 BUILD SUCCESSFUL

Jan 29 01:43:38.419 Total time: 0 seconds

Jan 29 01:43:38.422

Jan 29 01:43:45.481 BuildID: 56aad1db17f1a

Jan 29 01:43:55.946     [exec] Result: 1

Jan 29 01:43:58.032 BUILD FAILED

Jan 29 01:43:58.033 /Applications/CoronaSDK-2806/Corona Simulator.app/Contents/Resources/build.xml:429: The following error occurred while executing this line:

Jan 29 01:43:58.033 /Applications/CoronaSDK-2806/Corona Simulator.app/Contents/Resources/build.xml:407: jarsigner returned: 1

Jan 29 01:43:58.033

Jan 29 01:43:58.033 Total time: 4 seconds

Jan 29 01:43:58.078 Android build failed (256)

Jan 29 01:43:58.471 ERROR: Build Failed: Error code: 256

Firstly, are you using the Android debug keystore or one of your own?  If your own, try with the Android debug keystore.

What happens if you run this command in a Terminal window?

ls -l /usr/bin/jarsigner

If that results in a “no such file or directory”, what does this yield:

locate jarsigner

I’m using androiddebugkey.

When I run ls -l /usr/bin/jarsigner I get

lrwxr-xr-x  1 root  wheel  79 27 Nov 10:26 /usr/bin/jarsigner -\> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/jarsigner

What do you get if you run jarsigner itself in a Terminal?

jarsigner

Here’s a more acid test … what output does this command produce when run in Terminal?

JAVA\_TOOL\_OPTIONS='-Duser.language=en' jarsigner -tsa http://timestamp.digicert.com -keystore /Applications/CoronaSDK-2806/Resource\ Library/Android/debug.keystore -storepass 'android' -keypass 'android' /Applications/CoronaSDK-2806/Corona\ Simulator.app/Contents/Resources/\_coronatest.jar androiddebugkey
Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID()Ljava/lang/String; at sun.security.tools.jarsigner.TimestampedSigner.generateSignedData(TimestampedSigner.java:137) at sun.security.tools.jarsigner.SignatureFile$Block.\<init\>(Main.java:2378) at sun.security.tools.jarsigner.SignatureFile.generateBlock(Main.java:2276) at sun.security.tools.jarsigner.Main.signJar(Main.java:1272) at sun.security.tools.jarsigner.Main.run(Main.java:240) at sun.security.tools.jarsigner.Main.main(Main.java:104)

Interesting … how about:

JAVA\_TOOL\_OPTIONS='-Duser.language=en' jarsigner -keystore /Applications/CoronaSDK-2806/Resource\ Library/Android/debug.keystore -storepass 'android' -keypass 'android' /Applications/CoronaSDK-2806/Corona\ Simulator.app/Contents/Resources/\_coronatest.jar androiddebugkey

I removed the -tsa option as it seems to be giving your version of Java issues.

Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID()Ljava/lang/String; at sun.security.tools.jarsigner.TimestampedSigner.generateSignedData(TimestampedSigner.java:137) at sun.security.tools.jarsigner.SignatureFile$Block.\<init\>(Main.java:2378) at sun.security.tools.jarsigner.SignatureFile.generateBlock(Main.java:2276) at sun.security.tools.jarsigner.Main.signJar(Main.java:1272) at sun.security.tools.jarsigner.Main.run(Main.java:240) at sun.security.tools.jarsigner.Main.main(Main.java:104) BeerNathans-MacBook-Pro:goGetFixtures Nathan$ JAVA\_TOOL\_OPTIONS='-Duser.language=en' jarsigner -keystore /Applications/CoronaSDK-2806/Resource\ Library/Android/debug.keystore -storepass 'android' -keypass 'android' /Applications/CoronaSDK-2806/Corona\ Simulator.app/Contents/Resources/\_coronatest.jar androiddebugkey Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID()Ljava/lang/String; at sun.security.tools.jarsigner.TimestampedSigner.generateSignedData(TimestampedSigner.java:137) at sun.security.tools.jarsigner.SignatureFile$Block.\<init\>(Main.java:2378) at sun.security.tools.jarsigner.SignatureFile.generateBlock(Main.java:2276) at sun.security.tools.jarsigner.Main.signJar(Main.java:1272) at sun.security.tools.jarsigner.Main.run(Main.java:240) at sun.security.tools.jarsigner.Main.main(Main.java:104)

Hmmm … it seems like your Java installation is busted in some way.   jarsigner is a standard command used to build Android applications (however they are built).  I’ve installed Java version “1.8.0_71” and made sure I can build Android apps so this issue seems specific to your computer.

If I were you, I would remove and reinstall Java (you can find some help with this at http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html )

This is what I see on my computer:

&nbsp; ~ % java -version java version "1.8.0\_71" Java(TM) SE Runtime Environment (build 1.8.0\_71-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode) &nbsp; ~ % JAVA\_TOOL\_OPTIONS='-Duser.language=en' jarsigner -tsa http://timestamp.digicert.com -keystore /Applications/CoronaSDK-2806/Resource\ Library/Android/debug.keystore -storepass 'android' -keypass 'android' /Applications/CoronaSDK-2806/Corona\ Simulator.app/Contents/Resources/\_coronatest.jar androiddebugkey Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en jar signed. Warning: The signer certificate has expired.

Uninstalled, then Installed again. Same error code in Corona when building (256).

~ Nathan$ java -version java version "1.8.0\_71" Java(TM) SE Runtime Environment (build 1.8.0\_71-b15) Java HotSpot(TM) 64-Bit Server VM (build 25.71-b15, mixed mode)

~ Nathan$ JAVA\_TOOL\_OPTIONS='-Duser.language=en' jarsigner -tsa http://timestamp.digicert.com -keystore /Applications/CoronaSDK-2806/Resource\ Library/Android/debug.keystore -storepass 'android' -keypass 'android' /Applications/CoronaSDK-2806/Corona\ Simulator.app/Contents/Resources/\_coronatest.jar androiddebugkey Picked up JAVA\_TOOL\_OPTIONS: -Duser.language=en Exception in thread "main" java.lang.NoSuchMethodError: com.sun.jarsigner.ContentSignerParameters.getTSAPolicyID()Ljava/lang/String; at sun.security.tools.jarsigner.TimestampedSigner.generateSignedData(TimestampedSigner.java:137) at sun.security.tools.jarsigner.SignatureFile$Block.\<init\>(Main.java:2378) at sun.security.tools.jarsigner.SignatureFile.generateBlock(Main.java:2276) at sun.security.tools.jarsigner.Main.signJar(Main.java:1272) at sun.security.tools.jarsigner.Main.run(Main.java:240) at sun.security.tools.jarsigner.Main.main(Main.java:104)

I did some more research on this, but can’t find anything - there was a netbeans ticket, but it looks like it wasn’t ever repeatable.

Just for completeness, do you get the same (or similar) error just running jarsigner  with no arguments at the command prompt?

Yeah, I found that same NetBeans bug but couldn’t find anything else.

If I just type “jarsigner” I get a usage listing…

Usage: jarsigner [options] jar-file alias &nbsp;&nbsp; &nbsp; &nbsp; jarsigner -verify [options] jar-file [alias...]

Is that what you mean?

I was using the latest daily build…  couldn’t get past the error, even ensuring my Android SDK was up to date.  Reverted back to the public build and it’s working now.