First off. I’m not that bright. And I’m definitely not classically trained with old school computing like using command lines. Command lines scare me. Everytime I open a command prompt I feel like I’ve entered The Matrix and immediately gone blind and died.
Anyway, here’s whats up… Adobe just updated the AIR 2.6 runtime, which is required if you want to upload an app to Amazon’s Android store to sell. Well okay, I THOUGHT all you needed to do was replace the old AIR file with the new files. And that was kinda true, but it turns out you ALSO need to use the command line (here on the Mac, thats done with the Terminal) to change one small little thing. Amazon wants people downloading the AIR plugin from them instead of from Google, if the user of the app doesn’t have AIR yet. Which makes sense, so keep in mind if you are going to sell in both stores, you need to publish two APK files (the .apk is the app you’ll eventually build and submit).
So to make this little change, you need to repackage your app from the command line instead of from Flash CS5 (which Adobe says they will update soon for this 2.6 change). Well here’s what Adobe says to do...
The version of ADT in the 2.6 AIR SDK supports the new
airDownloadURLcommand line option when packaging your APK file. To make your AIR 2.6 application compatible with the Amazon Appstore for Android, your ADT command should look something like this:
adt -package -target ( apk | apk-debug | apk-emulator )
( CONNECT_OPTIONS? | -listen <port>? )
( -airDownloadURL http://www.amazon.com/gp/mas/dl/android/com.adobe.air )?
( <app-desc> PLATFORM-SDK-OPTION? FILE-OPTIONS | <input-package> PLATFORM-SDK-OPTION? )
Yes, love that quote. “Your command should look something like this”. And in the parenthesis it should say afterwards, “(tell ya more later, I’ve gotta catch my train home)”.
So lets suppose you are like me (dumb), and JUST getting started making Android apps with FlashCS5. Hopefully you’ve been following the past blog entries about how to do that (maybe even bought this tutorial) so you know how to setup your Publish Settings to actually build the apk file and test on your device. Great. Lets assume you’ve gotten that far.
When you publish, you’ve got…
- The swf
- The apk
- The Xml file (application descriptor file)
- The icons ( probably named icon36.png, icon48.png, icon72.png)
Now probably somewhere else you’ve got your self signed certificate, and lets assume you called that mycert.p12 (to publish you had to have already made that and entered your password)
Great. Lets make this easy on yourself. Take all those files, EVEN your certificate, and copy them to your user folder. In my case thats called “JustinsClone” (remember I’m on the Mac)
Now AFTER you’ve downloaded the Adobe AIR 2.6 tools , go ahead and copy those to your user folder as well. So now you’ve got a folder called AdobeAIRSDK beside all those other files above. Now open up Terminal. Here’s the line I used to get this to compile…
/Users/JustinsClone/AdobeAIRSDK/bin/adt -package -target apk -airDownloadURL http://www.amazon.com/gp/mas/dl/android/com.adobe.air -storetype pkcs12 -keystore mycert.p12 -storepass mypassword ninjatoss.apk ninja_toss-app.xml ninja_toss.swf icon48.png icon72.png icon36.png
Which looks confusing without line breaks so here’s what it looks like broken up…
ninjatoss.apk ninja_toss-app.xml ninja_toss.swf icon48.png icon72.png icon36.png
Notice at the end are ALL my files to include. Yours will obviously have your own names so change that to suit your files. Same thing goes for the certificate, mycert.p12 needs to be renamed in the command if you didn’t call yours that. Also mypassword will need to be your certificate password.
And another BIG thing to note, I couldn’t get this work unless the -airDownloadURL http://www.amazon.com/gp/mas/dl/android/com.adobe.air part was before the -storetype pkcs12 part. Which is contrary to everything else I’ve seen about adding that. So maybe its just a Mac thing and if you’re on the PC you need to run that line after the -storepass line
So why go crazy and put everything one place? Well, I did test this out a lot with the files in different locations and I kept running into errors, and it seemed like every forum about that particular error included one guy suggesting to just keep all your files in the main user directory. And I can’t argue with what works.
And did this work?? Well I hope, I’ve resubmitted my App to Amazon once again. But I feel good because I think if Terminal didn’t spit back out an error after the command above, its done the trick.