ADT command. AIR 2.6. Troubleshooting. I’m on a Mac Sigh.

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 airDownloadURL command 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 )? 
SIGNING_OPTIONS <output-package> 
( <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…

/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

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.

Advertisements

5 thoughts on “ADT command. AIR 2.6. Troubleshooting. I’m on a Mac Sigh.

  1. Eddie says:

    Oh well you beat me to it – I struggle with the writing up of these things.
    My blog is at http://flasheddierocks.com/blog/index.php/2011/04/compiling-a-flash-cs5-app-from-the-command-line/
    It includes copying the created apk from the command line to the device.
    And how to set up the xml manifest to allow move the app from device to SD if the user wants to.
    My only concerns with what you have done is that you haven’t set up the xml to include Initial Window or Permission settings in your xml but I may have gone over board with this.
    Cheers
    Eddie

  2. Hi Justin,
    Just in the xml. But the Flash generated xml doesn’t contain them, only basic info. I assume it puts them in the apk straight from its panels along with the initial windows info… As Ninja Toss doesn’t need permissions you may not notice when testing.
    Cheers
    Eddie

  3. Eddie says:

    V. confused now. Playing with getting something done for the Blackberry Playbook, been changing settings around in Flash and now seem to get an expanded xml including permissions that definitely wasn’t happening before. Don’t know whats going on!
    Eddie

  4. So I was finally able to create the APK file. This is my experience.

    There’s no need to download the Air SDK if you have the latest build of Flash Builder. You can target the ADT that is contained in your flash builder program folder.

    The ADT command creates the APK file. This blog post seems to imply that I needed to create an APK file before I run the ADT command. This is unnecessary since the ADT command’s purpose is to create the APK file.

    I also used the SWF file that was contained in the APK file that I created with Flash Builder for the Android Market to ensure it was a release build version.

    You can use the same certificate that you use to create an APK file for the Android Market; however, I’m not entirely sure the Amazon AppStore requires you to sign your app or if they do it for you. In any case, I used the same android p12 file that I used for the Google Android Market.

    Also, you will need to adjust the Application Descriptor XML file so the “application.initialWindow.content” node contains a reference to your SWF file. Flash Builder has a comment in this node that says that Flash Builder will automatically enter the correct value for this node. If you do not enter the correct value here, then you will encounter the following error when running the ADT command:

    error 105: application.initialWindow.content contains an invalid value.

    So once I did this, my command line looked something like this:

    “C:\Program Files (x86)\Adobe\Adobe Flash Builder 4.5\sdks\4.5.0\bin\”adt -package -target apk -airDownloadURL http://www.amazon.com/gp/mas/dl/android/com.adobe.air -storetype pkcs12 -keystore C:\PATH2ANDROID_CERT\androidCertificate.p12 -storepass [your_password_here] C:\PATH2WHERE_YOU_WANT_THE_APK_FILE_2B_CREATED\WordZigZag.apk WordZigZag-app.xml WordZigZag.swf assets/*

    p.s. I ran the command line while I was in the directory that contained my SWF file. Also, my icon images and other files that my application uses are all contained in the subfolder “assets/” and I was able to target these files (as seen in my command line above) by using a wildcard after the subfolder — assets/*

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s