I am building an Adobe Air for Android App and I have a big problem, i published an app to the android market us开发者_C百科ing an old flash air extension that saved the app id with a prefix 'app.'
Now that i have upgraded the extension it now saves the app id with a prefix 'air.'
What this means is that I can no longer publish updates to my applications; so what can I do?
The problem with using the outdated extension is that after publishing the update the user is not able to open the app until the cache files are cleared.
There is a simple environment variable you can set to disable the air.
prefix easily. The following code exists in the Adobe AIR packager:
String optOut = System.getenv("AIR_NOANDROIDFLAIR");
if ((optOut == null) || (optOut.indexOf("true") == -1)) {
packageName = "air." + packageName;
}
So, simply set the AIR_NOANDROIDFLAIR
environment variable to true
, repackage your application, and it won't have the air.
prefix. Google how to set environment variables in windows or mac for your particular OS version.
For example, I use the command-line compiler on Mac/Linux, so I run:
> export AIR_NOANDROIDFLAIR=true
> java -jar $AIR_HOME/lib/adt.jar -package -target apk-captive-runtime -storetype pkcs12 -keystore cert.p12 -storepass *** Main.apk Main-app.xml Main.swf
Warning: I don't know what implications this has. Per someone's note above, this may only be a good idea with captive runtime (but that's the default going forward from AIR 3.8).
Update: Renaun Erickson said this flag shouldn't cause problems.
Cross-posted here (slightly different question, same answer).
I will post my results with this problem in case any one else needs it. To sum it up though I hate say just republish your app as a new app.
I found this post that lays out how to break down your already compiled app, change the app prefix and recompile it.
http://kb2.adobe.com/cps/875/cpsid_87562.html
Now I must tell you it did not work for me. I got all the way to the last step, sign the repackaged app and upload to market. The problem I ran into was that the original app was signed with a mycert.p12 created by adobe flash cs5. jarsigner ( the thing you use to sign the app ) would not use this cert, it said it was in the wrong format. Don't try creating a new cert b/c the android market will ONLY let you update your app using the original cert, I did not know this at first. Ok so then I found that if you right click (windows vista) on the cert the top option installs the cert as a different file that you can then export from MMC ( go to Start - Run - type in MMC ) to a format that jarsigner allowed. The app was signed and I uploaded to market - error cert does not contain private key... DENIED. If you look into the cert using keytool -list it showed a serial number, a md5 and aes keys, I would have thought that one of these would have been the private key. I never found a way to sign the app in a way the market would allow. I have since republished the app and I am slowly migrating my customers by refunding the first purchase after they purchase the new one.
Lesson learned: Stay updated on your extensions. and most importantly BACK UP YOUR CERT FILE TO MANY MANY PLACES. IF YOU LOOSE IT YOU WILL NOT UPDATE YOUR PUBLISHED APPS AGAIN, at least that I found.
Here is a forum post from my researching this topic. http://forums.adobe.com/thread/800068?tstart=0
One last thing I learned about the market. There is no way to give your app away as a promo. They must purchase it. If you refund a customer that customers app might get deleted. I found several conflicting stories about this one though.
If you still want to dive in good luck.
Recently I did this and here are my results.
Tested and works fine with AIR SDK 15, Mac OSX 10.10 Yosemite. windows should work similarly.
To see all the options in adt.jar
java -jar $AIR_HOME/lib/adt.jar -help
To include ANE files add -extdir
export AIR_NOANDROIDFLAIR=true
java -jar /FULL_PATH_TO_AIR_SDK/lib/adt.jar -package -target apk-captive-runtime -storetype pkcs12 -keystore <DEVELOPER>.p12 -storepass <PASSWORD> Main.apk Main-app.xml Main.swf -extdir /PATH_TO_ANE_DIRECTORY
Instead of a .p12
file, if you have a existing android .keystore
, use -storetype jks
java -jar /FULL_PATH_TO_AIR_SDK/lib/adt.jar -package -target apk-captive-runtime -storetype jks -keystore <DEVELOPER>.keystore -storepass <PASSWORD> Main.apk Main-app.xml Main.swf -extdir /PATH_TO_ANE_DIRECTORY
For example
java -jar /Users/cforcloud/AIR_SDK/lib/adt.jar -package -target apk-captive-runtime -storetype jks -keystore /Users/cforcloud/android.keystore -storepass secretPassword Main.apk Main-app.xml Main.swf -extdir /Users/cforcloud/ane_directory
Find more such options for Android APK packages and Android settings
Thanks to @JeffWard
精彩评论