2

I am desperately trying to upload an Android-App that has been developed and packaged with Adobe Flex SDK 4.6 using Intellij IDEA. The PKCS#12 was created using openSSL (I just want to mention this, but I don't think this is the problem).

Everything worked fine until I got the silly desire to publish the App into the Google Play store. It destroyed all my dreams with this simple sentence:

Google Play requires versionCode to be set to a positive 32-bit integer in AndroidManifest.xml.

Okay, its not a secret that you can not define the Android versionCode from Flex SDK directly. You have to use the -Tag, which I did. Actually I tried this in several different combinations (of course only one at a time) like:

<versionNumber>0</versionNumber>
<versionNumber>1</versionNumber>
<versionNumber>2</versionNumber>
<versionNumber>0.0.1</versionNumber>
<versionNumber>1.0.0</versionNumber>
<versionNumber>2.0.1</versionNumber>

... and whatever you can imagine ...

But whatever I did, when I upload the APK, the status bar is going to 100% and starts counting backwards as if it was laughing at me and ends up with the above error message.

From the Adobe Community I learned that on Android, the AIR version a.b.c is translated to the Android version code using the formula: a*1000000 + b*1000 + c.

Well, using this formula all my values for the -Tag should become a 32-Bit Integer.

Any Ideas?

Randy
  • 1,299
  • 2
  • 10
  • 23
  • My app uploaded fine to the Google Play store using 1.0.1 as the versionNumber. I'm not sure what the problem may be here. – JeffryHouser Nov 30 '12 at 01:06

3 Answers3

2

This appears to be a bug in Flex, try numbers such as 999. See this thread http://forums.adobe.com/thread/765086

You can also take apart the apk that Flex generates and take a look at the manifest to see what is going on, you might even be able to put it back together after manualy cahnging the value check out How to view AndroidManifest.xml from APK file?

Community
  • 1
  • 1
mbwasi
  • 3,612
  • 3
  • 30
  • 36
  • Was just going to suggest patching the APK - normally a silly thing to do when you have the source, but if the tool flow is being this obstinate, at a certain point one might just want a shortcut to a fix. – Chris Stratton Nov 29 '12 at 21:09
  • I just decompiled the APK using apktool and had a look at the resulting AndroidManifest.xml. The versionCode was set to "0". This is definitely a bug. – Randy Nov 29 '12 at 21:23
  • That link is from 2010 and used a beta version of Flash Builder. This can't be a bug in Flex; but it may be a bug with the AIR SDK shipped with the Flex SDK/Flash Builder. I have not run into it personally and have used similar numbers to what the original poster used. – JeffryHouser Nov 30 '12 at 01:04
  • I am not using FB but Intellij IDEA which package the APK using the Flex SDK. So it is most likely a bug in the Flex SDK since the resulting versionCode is "0". – Randy Nov 30 '12 at 11:09
2

The Flex SDK has a bug which is listed here so that I had to choose a workaround that I would like to share with you here.

My solution is to unpack the APK-File, edit the AndroidManifest.xml, pack the APK-File again and sign it. I use the apktool and jarsigner (part of JDK).

java -jar apktool.jar d MyApp.apk // unpack
// edit AndroidManifest.xml
java -jar apktool.jar b MyApp_patched.apk // repack
jarsigner -verbose -sigalg MD5withRSA -digestalg SHA1 -storetype pkcs12 -keystore ../AndroidCertificates.p12 MyApp_fixed.apk "1" // sign
Randy
  • 1,299
  • 2
  • 10
  • 23
1

Version code is an incremental number to keep track of which build is the latest.

What your talking about is the versionName, versionName can be 0.0.0.0-SNAPSHOT or whatever

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.my.app"
    android:versionCode="23"
    android:versionName="1.2.1" >

versionCode is an integer

versionName is a String

http://developer.android.com/guide/topics/manifest/manifest-element.html#vcode

Blundell
  • 75,855
  • 30
  • 208
  • 233
  • Thank you, but I am aware of that. The Problem is that I am using the flex SDK where you can not enter the versionCode since it is beeing derived from the versionNumber (Flex SDK). Please have a look at the formula I mentioned. The result should be what the Flex SDK puts into the versionCode-value. – Randy Nov 29 '12 at 21:05