APK File Not returned by Corona Labs Server!

What information from my system profiler do you need? A full export is 4.5mb of xml text.

Ok, this is very odd.

Just tried it on my Mac, and get the exact same error as on my PC and same as Poon.

Poon are you a beta tester like myself?  Just curious as it only seems to be affecting only a few people.

Strange how it’s the same on both my PC and Mac.

Nope, I’m not a beta tester. I have Corona Pro.

I’ve tried two different Macs, both with the same result.  Did not try Windows.

Hi Alex,

Can you compress the entire XML file and e-mail it to me? I know it’s a large file, but I’d like to see the entire contents. Email is brent (at) coronalabs (dot) com.

Thanks,

Brent

Hi Brent, it should be in your inbox.

Thanks Alex! I received it and forwarded it to the engineers investigating this issue.

Brent

Hi Brent.

I have made some progress in getting to the bottom of what’s going on.

Here is what I’ve found.

So up to and including 2013.1092 everything works fine for building my apps or the sample apps using my keystore.

From 2013.1093 onwards it fails to return the APK on both PC and Mac with the following output using the same keystore:

[exec] Result: 1

[exec] Result: 1

So I just tried building ‘Hello World’ sample app  on 2013.1095 using the debug.keystore that I have had for a year and it built and returned the APK file.

Conclusion:

Using my own keystore I cannot build from 2013.1093 onwards on either PC or Mac, which also ties in with the daily build notes for 2013.1093 which are:

Mac/Windows: Added support for JDK 7
(32-bit/x86) to the Corona Simulator for Android builds. (This is used
to digitally sign APKs. Note that the 64-bit versions are not supported.
Corona Enterprise developers must still use 32-bit version of JDK 6,
which is an Android requirement.)

There is no doubt in my mind that this is where the problem lies.

I also wanted to point out that I have a password for my keystore alias as well so I need to input two passwords every build.

OK I believe I have found the issue.

@poon.  Alex can you please confirm that you use 2 different passwords when building ie a keystore password and a key password please?  As I am confident this is the issue as of 2013.1093.

Here is what I did to test.

Created a new test keystore file and put in my credentials, which has 2 passwords ie keystore password and key password, just like I did for my working keystore (up to 2013.1092)

Tried to build APK file (2013.1095) - FAILED

So created another keystore file with the same credentials and this time when it asks:

Enter key password for <xxxxxxxx>
        (RETURN if same as keystore password):

I just pressed return so that they are the same password.

Tried to build APK file (2013.1095) - WORKED

Conclusion:

THere is something wrong as of 2013.1093 with the way Corona deals with our keystore files.

If you have a different kestore password and key password it will not return the APK file

If you have the same keystore password and key password it will Build and return the APK as expected.

I and some others cannot just go ahead and create new keysore files as it will mean that our previous apps will no longer be able to be updated.

Everything was working fine before Corona introduced in 2013.1093:

Mac/Windows: Added support for JDK 7
(32-bit/x86) to the Corona Simulator for Android builds. (This is used
to digitally sign APKs. Note that the 64-bit versions are not supported.
Corona Enterprise developers must still use 32-bit version of JDK 6,
which is an Android requirement.)

So there is a bug in the way Corona handles keystore files with a different keystore password and key password as of 2013.1093.

This is why it is only affecting a few people as I believe most will use the same keystore and key password.

Hopefully now you can get a fix out as soon as possible.

Everyone,

I was able to reproduce this issue yesterday on Windows and discovered it can happen if your “PATH” environment variable references a “jarsigner.exe” that is JDK 5 or an older version.  Even though Corona finds the correct version of jarsigner on your system (we hunt it down when you open the Android build window via the registry), that environment variable is effectively overriding the version of jarsigner that we’re telling the build system to use.  Also, Icy Spark is correct that this issue was introduced in daily build #1093, which is the version we added JDK 7 support.  The settings we are passing into the jarsigner in that daily build are not supported by the JDK 5 or older jarsigner versions.

That said, we’ve developed a fix for this yesterday and we’ve successfully signed an APK using the JDK 5, 6, and 7 tools.  We’ve also modified the Corona Simulator for Windows to ignore the “PATH” environment variable when doing an Android build to ensure that our build system uses the version of JDK tools expected.  We’re performing the final tests now and plan on pushing out a new daily build this afternoon.

Icy Spark - I created my keystore a long time ago, but I actually believe I did not use two separate passwords when creating it.  So, at least for me, that wasn’t the issue.

Joshua, will your fix work on Mac OS X as well?

Hi Alex,  do you have “save password” ticked when you click “Key Alias”?

Also when you press build does it ask you for a password?

Hi Joshua,

Hopefully the new fix will work, but I have my concerns.  Here’s why:

I get the same error on both PC and Mac.  Both are running JDK 6 - no sign of JDK 5 on either system.

My Windows PC PATH environment variable goes to C:\Program Files\Java\jdk1.6.0_38\bin and both my keytool.exe and jarsigner.exe files are file version 6.0.380.5

As I mentioned previously:

When building It asks me to enter the password for Keystore: C:\Program Files\Corona Labs\Corona which unlocks my Key Alias

Then when I click build it asks for Please Enter Password for Key Alias: xxxxxxxx

this password is different from previous one.

If i do a new test keystore and keep these passwords the same all works well and I can build on both PC and Mac, which would make me assume that the system is finding and using the correct jarsigner.exe.

What causes the problem for me is the different key alias and keystore passwords on both PC and Mac.  All worked fine prior to 2013.1093

Also Joshua,

You should be able to reproduce this by generating a new keystore using a PC.

When it asks for your alias password:

**Enter key password for <xxxxxxxx>

        (RETURN if same as keystore password):**

Type in a different password from your keystore password that you created at the start of the process.

You don’t have to have the JDK 5 installed.  Your “PATH” environment variable just has to point to an older version of the “jarsigner” tool.  If I have in fact reproduced the same issue you ran into, then look in each directory your “PATH” environment variable references and see if there is a “jarsigner” app in them.  If there is, then that “jarsigner” app is being used instead of the one Corona is trying to use.  This particular issue can happen on Windows and Mac… but it is more likely to happen on Windows since having multiple versions of the JDK/JRE is much more common.

I can’t reproduce the keystore issue that you are having, but I’m guessing that you are running into the same “PATH” environment variable issue with that too… where the “keytool” that you are running at the command line is grabbing an older (or newer) version than you expect.  I know the JDK 7 tools use a different encryption algorithm by default that Android does not support.  If this is in fact the issue, then the solution is to go to the JDK 6’s “bin” directory yourself at the command line (ie: “CD” to it) and create the keystore there, because then you’ll know for sure that you are using the correct version of keytool… or use an absolute path to the “keytool” at the command line from the JDK 6 directory.

Hi Joshua,

I have tried everything you suggest. 

Searched my whole PC including hidden files for jarsigner.exe.  1 result in C:\Program Files\Java\jdk1.6.0_38

Checked PATH Environment variable.  Nothing interesting there.  One result is C:\Program Files\Java\jdk1.6.0_38\bin  which is where the only jarsigner is on PC.

Also CD’d into C:\Program Files\Java\jdk1.6.0_38\bin and created the keystore.

As I said earlier though this is the crux of it:

I can create a keystore that will work fine with Corona and give me an APK file ONLY if I use the same keystore and key alias password.  So I know I don’t have any PATH issues.

I can again create a keystore no problems using a keystore password and key alias password.  Corona accepts everything, connects to the server,  does it’s stuff, tells me build is completed, to view it in explorer but no APK file is returned.

So it is not a matter of if I can create a keystore file.  I’ve never had a problem with that.  It’s the way Corona 1093 and up is handling the fact that the keystore file has a keystore password AND a key alias password when it is sent to the server.

Please try creating a keystore file but at the end when it asks:

**Enter key password for <youralias>

        (RETURN if same as keystore password):**

Do NOT press return, but create a different key alias password. 

Then try to build android apk using this keystore file,  wait for it saying it’s completed, and tell me if you can see the newly created APK file.

Well if that’s the case for you, then I might not have reproduced the exact circumstances that are causing this issue on your system.  But that said, we’ve modified the Corona Simulator to fallback to our old APK signing method in case our new signing method (which supports the JDK 7) fails.  So, if the Corona Simulator was able to create and sign an APK before daily build #1093, then that means the Corona Simulator will fallback to the old signing method on your system… which should always work for you.

A new daily build with this change should be made available 2-3 hours from now.

Thank you Joshua.  I know it’s a lot of hard work on your end and I really appreciate it. 

Just to let you know that it’s the same issue on my Mac as well,  so it’s not just a specific system issue.

Will let you know the results as soon as the daily build goes live.

Just tested build 2013.1100 on PC

APK File is now returning from the server.  Thank you very much for your incredibly hard work.

It does still show this on the Corona Simulator Output:

[exec] Result: 1 

whereas before it showed:

[exec] Result: 1

[exec] Result: 1

Great! I’m glad it’s working for you!

Yeah, it’s showing you that “Result: 1” message because the first attempt to sign the APK failed, but now it falls-back to the old signing routine we had before.  The result value “1” indicates the exit code that was returned by the jarsigner tool.  I briefly looked into preventing it from echoing that to the terminal, but if I did, then it would prevent other useful error messages from being outputted as well.  So, I opted in to keeping it that way for tech-support purposes.

The next trick for us to solve is discovering why the first attempt to sign your APK fails.  We’ll be testing out some ideas later.