Watch videos with subtitles in your language, upload your videos, create your own subtitles! Click here to learn more on "how to Dotsub"

Debug Adobe AIR for Android Applications

0 (0 Likes / 0 Dislikes)
[ringing sound] [ADOBE DEVELOPER CONNECTION] Hi, I'm Ryan Stewart, an evangelist here at Adobe. [Ryan Stewart - Platform Evangelist] Today I'm going to show you how to debug AIR for Android applications on the device. AIR for Android is currently in private beta, but it's available on Adobe Labs. You can just go sign up for the private beta and then get access to the SDK, documentation, and everything you need to build AIR for Android applications. I've got a basic application here, which is really just a button, a text area, that when I click the button, it's going to go call this clickHandler function, and it's going to change the text area text and do a trace statement. If you're using Flash Professional CS5, you can do a debugging on the device. You can use the visual debugger in Flash Professional. But if you're using Flash Builder, you have to use the command line for right now to debug these AIR for Android applications. And you can debug this application typically, so if I just debug it using the Debug button, it'll open it up in the AIR application ADL, and I can see the trace statement, I can set breakpoints and all that kind of thing, but I can't do that on the device from Flash Builder. I have to break in and do things a little bit differently to actually debug on the device directly. The first thing that I have to do is go into the Manifest file, so the app.xml file. And if you've built AIR applications before, you should be very familiar with the app.xml file. You'll notice if you scroll down to the bottom that we've added some Android-specific things. So I need to make sure that I have access to the Internet to do this, and so you'll see an Android tag with manifest additions and then some specific Android XML data. So I've already got this sort of cleaned up, and I will uncomment it. The debugger for Android does something kind of cool. It's baked into the run time, so when I create a debug version, it'll put it on the device and then the device will connect wirelessly to my computer so that I can control the debugging, I can set breakpoints, I can see trace statements on my machine. The caveat here is you have to be on the same wireless network, so the device has to be on the same wireless network as the computer, so you have to enable your WiFi on the device and make sure it's connected to the same network that my computer is connected to. Once you've done that, you can go ahead and package a special version of the application. So I am going to use ADT to compile an APK file, but instead of normal commands where I would just compile a release.apk file, in this case I want to make sure that I'm compiling a debug.apk file, and I also want to bake in the IP address for my computer so that the Android application knows to connect to this computer when it's looking for debugging information. So let me go ahead and make sure I create my APK file. I will do that with ADT and then package - target, and the target is going to be APK debug, so apk - debug, and then I have to set a connect setting, so I'll do - connect and pass in the IP address of my computer, which is 192.168.1.3, and then I use the typical ADT commands, so I need to set my store type, pkcs12, my keystore to the certificate path, and then just pass in the output, so the APK file, so we'll do Debugging for Android at APK and then pass in the manifest file and the SWF file that we want to package up. All right. Then we run that. It'll prompt me for my password for the certificate, so I'll put that in. It'll take a second, but now it's going to create a debug version of that APK file. An APK file is a native Android file format, so you can put it on the marketplace and it behaves like any other Android application, and I can then deploy it to the device using the Android SDK. So make sure it created correctly. All right. Then we can go to the Android SDK and use a file called ADB to actually send this to the device. So Library SDKs, ADB, and we want to do an install of that APK file, so Debugging for Android.apk, push Enter, and now it's going to send that to my device which is connected via USB. You can see the status updates. Now that it's connected, I can run FDB, which is part of the Flex SDK, which is the command line debugger, and then get information about my application from the device directly. So let me go ahead and load that up in the command line here in the terminal. [keys clicking] I've got that as part of the Flex 4.1 SDK. And then FDB. You need to have sudo access to do FDB or you can give it exchange permissions, but I'll do sudo, that one. So now the command line debugger is running, so I just need to do R, which is going to wait for it for a player to connect to it. And since we've already baked in or hard coded that IP address, I just have to go to the device and then run my application, and it will automatically connect to the debugger. So there's the debugger, so I'll open that. It's going to prompt me for an IP address. Let me make sure. Type in 1.3, and there we go. So now we put the IP address in. You can see on my machine FDB is now waiting for it, so I can just type Continue. I'm not going to set any breakpoints. We're just going to look at the trace statement. But I can set Continue, and FDB will allow me to walk through the application on the device. And when I click this button, it will use the trace statement and trace it back out to my command line. So there's the trace statement on the command line. So there's a bunch of information about using FDB on the live docs on the Flex SDK documentation, so if you want to get more involved and set breakpoints and use this to its full extent, you can go find that information. [For more information labs.adobe.com] But now you at least have an idea of how to use the FDB command line debugger with AIR for Android to make sure that you're getting information from the device on your machine. [ADOBE DEVELOPER CONNECTION]

Video Details

Duration: 6 minutes and 25 seconds
Country:
Language: English
License: All rights reserved
Genre: None
Views: 213
Posted by: adobetv on Oct 21, 2010

Join Platform Evangelist Ryan Stewart as he examines how to debug applications built with Adobe AIR right on your Android mobile device.

Caption and Translate

    Sign In/Register for Dotsub to translate this video.