Skip navigation
johnpaok
Currently Being Moderated

Air for android emulator black screen

Apr 17, 2012 11:45 AM

Tags: #android #flashpro5.5 #air3.0

I run my app for android which I made with flash cs 5.5 and Air 3.0 on my Emulator. Way I see only a black screen on my Emulator?

 
Replies
  • Currently Being Moderated
    Apr 17, 2012 11:56 AM   in reply to johnpaok

    How are you installing the apk into the emulator?

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 12:47 PM   in reply to johnpaok

    Have you quick published for device debugging from flash before? Have you ever made any other apps or is this your first?

     

    It requires Adobe AIR installed on an Android so you will need to make sure you're putting the captive runtime in your APK or it will not run.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 1:04 PM   in reply to johnpaok

    Here's a basic link from Adobe on installing AIR although it's not telling you where to get it from, so it will install whatever version of the SDK you have:

     

    http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc 9cd0cb-7ff6.html

     

    Your problem is your Android Emulator does not have "Adobe AIR Runtime" installed. For Android, your .apk file does not contain the Adobe AIR Runtime. So you need to get Adobe AIR Runtime installed into your Emulator or your apk will never run.

     

    Captive Runtime is an option in Flash Builder when exporting an APK file. What it means is it embeds an Adobe AIR Runtime directly into the APK. I'm not certain if Flash Pro supports this option but if it does it will be in publish settings. You will notice your apk file size goes up drastically once you install the captive runtime. If you install it, your app will work without needing to install Adobe AIR Runtime on the Android Emulator.

     

    Here's another link on this issue:

    http://forums.adobe.com/message/3909016

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 17, 2012 2:30 PM   in reply to johnpaok

    If you read the links I posted, the AIR SDK you have installed has a runtime it will install for you on your device.

     

    Connect your device and make sure it's visible to the SDK, then run this line:

     

    adt -installRuntime -platform android

     

    It will install the AIR runtime that is located in your AIR SDK in this path:

     

    AIRSDK\runtimes\air\android\emulator

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 5:37 AM   in reply to johnpaok

    You can run that to install it into emulator, the device isn't necessary just optional.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 6:16 AM   in reply to johnpaok

    Have you run the command I listed above?

     

    adt -installRuntime -platform android

     

    That should install the SDK into the emulator itself as mentioned in the links provided. If you have Android SDK version 3.0 then it should install AIR 3.0 Runtime into your emulator.

     

    I'd suggest upgrading to AIR SDK 3.2 if you want some of the new 3d goodies.

    http://www.adobe.com/devnet/air/air-sdk-download.html

     

    edit:

    Having the latest Android SDK helps too:

    http://developer.android.com/sdk/index.html

     

    Also if your emulator is not running (run adb to see devices connected) then it will not be able to install it. By saying "make sure you have your device connected" (for clarity) I mean "run your emulator because it is considered a device".

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 6:40 AM   in reply to johnpaok

    adt comes with any AIR SDK you have installed (there's one in Flash Pro and one in Flash Builder or you can download the latest from the link I gave).

     

    Don't get confused. The ADT tool is for Adobe AIR, the Android Emulator adb tool is for the Android Emulator. They're 2 completely different SDKs. What I mentioned (adb) is in the Android SDK not the AIR SDK.

     

    Yes adb is installed in the platform-tools folder and yes you should be in a cmd prompt for ease. In the command prompt just type "adb devices" and it will tell you any devices (including emulators) you have running. Before you run it, you should have the emulator open running on a device profile you already set up via the AVD Manager.

     

    It's worth mentioning, if you already haven't, that you should run the SDK Manager.exe and make sure you have already installed the version of Android platform you want to target. Then when you run the AVD Manager you can select that platform to run the emulator on. Then 'adb devices' will see it as a connected device.

     

    After all of that, run the command from the AIR SDK bin folder:

    adt -installRuntime -platform android

     

    That should install the AIR runtime on what it thinks is your connected device (the emulator). After install your APKs should work.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 7:23 AM   in reply to johnpaok

    Sometimes a picture is needed. Getting your device running in the emulator with a profile installed is key here.

     

    http://www.filehorde.com/o/devices.jpg

     

     

    What you see me have up is AVD. I installed the 2.3.3 platform, for example. I made a "new" device using it. I pressed the Start button and my Emulator pops up.

     

    Then in the DOS window above you can see me navigate to my Flash Builder install (which has AIR 3.2 overlayed) and I'm in the bin folder. I run the command as I've mentioned. It takes about 3 minutes to complete and you see no errors.

     

    I then change back to my AndroidSDK and go in platform tools and run "adb devices". You can see I have both my phone AND the Android Emulator running as devices. Yet the adt command still worked perfectly and installed in the Emulator as you see in the picture.

     

    Look at the Emulator screenshot. After I ran the adt command, I now have Adobe AIR installed in the emulator.

     

    Hope that helps.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 7:39 AM   in reply to johnpaok

    Flash CS5.5 comes preloaded with AIR 2.6. The location is here:

     

    C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\AIR2.6\bin

     

    But 2.6 is very old. You should overlay AIR 3.2 into Flash CS5.5 for best results. Here's a link to explain this process:

    http://helpx.adobe.com/x-productkb/multi/overlay-air-sdk-flash-profess ional.html

     

    Don't worry that the tutorial doesn't say the latest version of AIR 3.2, the process is pretty much identical except you change the version of AIR they mentioned (the namespace, folder name, etc) to 3.2 instead of 3.0.

     

    Otherwise.

     

    All you really need to do is download the latest AIR SDK with the link mentioned above and extract it anywhere on your system. You do not need to have AIR3.2 installed in Flash Pro (although I'd recommend it). It doesn't matter where you stick the AIR SDK files at all. I just happen to have 3.2 overlayed in Flash Builder as that's what I use instead of Flash Pro (but I have both).

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 8:35 AM   in reply to johnpaok

    Lets step back and make one thing clear.

     

    AndroidSDK and AIR SDK are 2 different SDKs.

     

    They are separate.

     

    AIR SDK has adt and adl.

     

    Android SDK has adb, AVD Manager and SDK Manager.

     

    You need to have both of them.

     

    Here's a picture of my overlayed AIR 3.2 on Flash Pro CS5.5 as well as a completely separate folder for my AndroidSDK. You can see the executables I am talking about, nested in their proper separate SDKs.

     

    http://www.filehorde.com/o/filesneeded.jpg

     

    You can see how the top 2 Windows Explorers show the AndroidSDK. You can see adb as well as SDK Manager and AVD Manager.

     

    You want to go to the location you see in the top 2 to set up your emulator to run.

     

    The bottom Windows Explorer shows this path for me:

    C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\AIR2.6

     

    This is the AIR SDK. Regardless that the name of the folder says AIR2.6, the instructions above tell you to overlay AIR 3.2 into this same folder. So this is actually my AIR 3.2 SDK. In there you can see clearly there is adt and adl.

     

    You need to keep in mind which SDK has which executables.

     

    If you do not follow the depicted, verbose instructions here to install the AIR SDK in your emulator and you are not producing an .apk that embeds AIR (captive runtime) then you will only ever see a black screen and your APK will never work.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 11:28 AM   in reply to johnpaok

    The androind SDK emulator is not a part of Flash Pro. It is separate, yet they integrate.

     

    You run your emulator from the AndroidSDK first, then Flash Pro can see it as a device and thus let you run on the emulator publish option.

     

    Here's a picture. I installed AIR as I outlined above. I ran the emulator from AndroidSDK's AVD Manager. So before I selected to export for emulator I already had the emulator running.

     

    I then just made a quick fake certificate so I could publish and pressed publish. It found the emulator, ran it, and I see my text (not a black screen).

     

    http://www.filehorde.com/o/kwtf.jpg

     

    You can clearly see I have a flash document with nothing but publish for AIR for Android being used, my emulator up on the right, I choose to export to Emulator and check to install and launch on the device. I click Publish and what do you see in the emulator? Not a black screen, you see my text.

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 11:54 AM   in reply to johnpaok

    Are you all set now? If so please mark the question as answered. Thanks

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 18, 2012 12:33 PM   in reply to johnpaok

    Exiting on Android? Run this:

     

    NativeApplication.nativeApplication.exit();

     

    For mailto you can try the old:

     

    navigateToURL(new URLRequest("mailto:some@email.com"));

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 19, 2012 6:02 AM   in reply to johnpaok

    The "name" is a tricky subject. You can only access an object on the display list by a quick name if it is placed in your timeline from your library and you assign it an instance name of ExitB. What you name it in the library is meaningless. Just to get that straight.

     

    I'll paste an old image of what an instance name is (in the properties panel) when you have something selected that is a movieclip on stage. This picture is for another thread but you'll get the general idea.

     

    http://files.ertp.com/temp/exfix.jpg

     

     

    In the case it is as you say and your instance name is ExitB then you would write a listener like so:

     

    ExitB.addEventListener(MouseEvent.CLICK, function(e:MouseEvent):void { NativeApplication.nativeApplication.exit(); });

     

    As far as the pictures being too small you'll need to give more information on this. Do remember the emulator tries to mimic android devices but androids have the unique issue of unknown "form factor". It means any developer can take their phone, give it any resolution screen they want and run the OS. So your app is going to need to get ready to sniff out the available resolution and resize your interface to suit it.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points