Download

Android Project Packaging fails when "For Distribution" is checked in project settings.

I have been having an issue for the last couple of days packaging my Android project, when I package it as a shipping build with the option to include debug files turned off the project packages perfectly fine with no issues, however there are still debug files packaged with it even though I set it not to include them and packaged it as a shipping build, a little google search told me that to remove all of the debug files so the the .APK can actually be uploaded to my Google Play Developer Console I needed to check the “For Distribution” box in the package settings, so I did. This is where my issues starts… If I try to package my project with the “For Distribution” check box checked it fails every time with the same error

[2017.05.25-19.51.41:741][123]UATHelper: Packaging (Android
(ATC)): C:\NVPACK\android-sdk-windows ools\ant\build.xml:871: Can’t read [C:\NVPACK\android-sdk-windows\platforms\android-25\android.jar] (Can’t process class [java/text/CollationElementIterator.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

I have tried rolling back my JDK version from 1.8 to 1.7, I have tried doing a full rebuild on packaging, I have used Codeworks version 1R4,1R5, and 1R6…nothing I do makes any difference except unchecking “For Distribution”, no matter which codeworks I am using or which Java SDK I am using I get the same error on every package attempt unless I uncheck the “For Distribution” box, and as I stated above, I can successfully package the project with a development or a shipping build as long as that one check box remains unchecked, but according to what I found on google after I was unable to upload my .APK to my Google Play Developer Console that check box must be checked.

What are you setting for the following:

android settings:
min SDK version
target SDK version

Android SDK settings:
SDK API level
NDK API level

? If you’re using android-25 anyway that is too new. Which devices are you wanting to target?

2017-05-26_14-26-59.png03c5e06a903514d72eef0c63beed9a2755dca6b2.png

This is my first time trying to package for android and I really don’t get why this fails ONLY when for distribution is checked and why debug files are included in the .APK even when the option to add debug files is unchecked unless for distribution is checked. Regardless of how I build the package (development or shipping build) it works 100% of the time unless For Distribution is checked then it fails 100% of the time with no other alterations being made to the project whatsoever except that one checkbox. I have tweaked all of the package settings repeatedly based on other forum post answers as to what should be in there to make it work and still it fails every time I select for distribution, and everytime it fails it is the same error

C:\NVPACK\android-sdk-windows ools\ant\build.xml:871: Can’t read [C:\NVPACK\android-sdk-windows\platforms\android-25\android.jar] (Can’t process class [java/text/CollationElementIterator.class] (Unsupported class version number [52.0] (maximum 51.0, Java 1.7)))

I guess we need to see the full log of the export - can you attach/paste it?

This is from a couple of days ago when I was still attempting to get packaging to work and the same file I posted on answerhub when I was trying to fix this.

Have you tried reinstalling codeworks?

at least five times at this point.

Well…I don’t know what I did, but that error is gone, now I have a new issue where it is trying to find my keystore file on a nonexistent drive…Build fails now with “C:\NVPACK\android-sdk-windows ools\ant\build.xml:1147: Y:\Pulsar_Battles-key.keystore (The system cannot find the file specified)” I do not have a Y drive on my machine, so I’m not sure why it is trying to read my keystore file from a non existent drive.

So, I uninstalled codeworks and reinstalled it again, deleted all of my build folders for this project, plugged in my android device and deployed it to my device, remade my keystore file and replaced it, repackaged a development build, and then tried to package a for distribution build again. I no longer get the previous warning about not being able to read the .jar file but now as I stated above my last post when I try to package a for distribution build now I get an error that the system cannot find my keystore file but it says it is looking on a Y drive, which I do not have(this could be intended by UE or not I have no clue) and that is the only error that is being generated on the build failure now.

This error: “(Unsupported class version number [52.0] (maximum 51.0, Java 1.7)” was caused by having an old Proguard version that didn’t support android-25 jar file format. The 1R6u1 installer has a patched Proguard (5.2.1 instead of 4.7) which fixes this.

The drive Y: is normal; UE4 4.16 patches the ant.bat on Windows to use subst with an unused drive letter during packaging so we can work around the 8K commandline limit on Windows. The file paths were too long.

Did you place your keystore file in your project’s Build/Android directory? This is where it is copied from into Intermediate/Android/APK so the signer can access it.

Yes, the keystore files was replaced, then deleted and remade several times now. Every time I try to build the project it comes back with the error that it cannot find the keystore file on the drive Y:. I have even tried just making a new completely blank project and packaging that with just the keystore set up, I still get the same error, if I move the keystore file to a different folder then I get a general “Could not find security key” error, if I put the keystore file back in the correct location I get the Y drive error again. I am really not sure what else to try at this point, I have checked all over the internet for a solution but just keep coming back to general guides on creating the keystore and putting it in the right folder, which I keep redoing just to make absolutely sure I did it right and get the same result.

In all honesty I cannot tell you what is causing this, or how to consitently reproduce it because with using the 2d side scroller example as a test, I can succesfully build a for distro build some times, then I can go back with the exact same settings, still nothing added to it and try to build it and will get the error that the keystore could not be found on the y drive… I just spent an hour trying to package the 2d side scroller example for distro to use as an example for myself after succeeding before work today and getting that error. I got frustrated and left to eat, came back and without changing anything hit package and it succeeded.

So I went back to my actual project, changed absolutely nothing and just hit package for distro just because I was tired of looking for answers and wanted to generate a fresh output log(I deleted the output log file this morning) and it just worked…I didnt change any settings or the location of my keystore since getting the error, nothing.

Not sure what is going on, then. Putting the keystore file in your project’s Build/Android directory and just putting the name of the file into the project settings (NO PATH) is all you should need along with the key alias and password(s). After packaging you should see everything from Build/Android was copied to the project’s Intermediate/Android/APK directory which is where it is read from by Ant during the APK signing step.

I can’t reproduce the issue here.