Wednesday, January 22, 2014

Resolving Unsigned AIR Runtime.apk



This might be a basic thing on working with any devices nowadays. But keep get me stuck for a while just to install AIR Runtime from AIR Runtime SDK into Android emulator.

If you don't already know, AIR SDK brings its runtime packaged for your emulator in this place

/AIRSDK/runtimes/air/android/emulator/Runtime.apk

But installing this runtime into emulator using this command

$ ./adb install Runtime.apk 

Will result in this fail notice

Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]

Its all is only a problem with signing. Early AIR SDK packages comes up with a signed runtime. But the latter ones is not signed yet. So I guess people at Adobe might think that signing an apk file is a basic thing for every Android developer out there.

As for me, it means more things to learn. If you doesn't already know, you can continue to read.

Firstly, create your keystore ready.
$ keytool -genkey -keystore mykeystore.keystore -alias andi

And fill all the asked data as you wanted it to be.

Once you get your keystore ready, now sign that Runtime.apk file you get from AIR SDK.

$ jarsigner -keystore ./mykeystore.keystore ./Runtime.apk andi

And start the installation on your machine

$ ./adb install Runtime.apk 

If you still get this notice

Failure [INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES]

Then you'll need to remove that already installed old AIR runtime, or just put -r before .apk file name

$ ./adb install -r Runtime.apk

All takes time in less than a minute if you already know what to do, but spend me almost two hour to get it done.

For a more complete reference for this signing thingy, you can go here: https://www.owasp.org/index.php/Signing_jar_files_with_jarsigner


Tuesday, January 21, 2014

AIR App Crashed On Android Emulator



AIR application and Android emulator made my progress stuck for days. Running my app on emulator gives me this error:


Could not find class 'com.adobe.air.AIRWindowSurfaceView$3', referenced from method com.adobe.air.AIRWindowSurfaceView.DoSetOnSystemUiVisibilityChangeListener

If you only want to know the answer, here it is:

Create an emulator with Android OS version >= 4.x, or if you can, force emulator to use Armeabi-v7a as CPU


UPDATE

Additional setting is required if you work with Stage3D on emulator. You'll need to check "Use Host GPU" when creating the Android AVD. Or else you will receive "Context3D not created" message.

Thanks to Rafael Alvarado for this suggestion.


CONTINUE

Thats it, and I hope that saves your day. Now continue to my story.

While the app is working properly on any Android devices. App also runs smoothly on Android emulator before I updated everything from Android SDK and AIR SDK. This quite gives me a headache as I want to test my app on the go. What made things worse is that updating AIR SDK, or changing application.xml, or switch between AIR packagings is not helping at all.

I googled this bug and saw people seeking for clue for this problem on many tech forum. But many, if not all, of the thread has zero people answered or commented. Perhaps because this problem is something that should be easily solved or not many people stuck with this problem.

Puzzle is a bit solved when I read an answer from admin of an Adobe forum, where people asking for AIR app on Windows machine, stated that AIR won't run on x86 engine. But that is not the exact answer, as my emulator OS runs on Arm CPU, that gives me no problem before I update everything.

As a side note, while project is continued by debugging process done on device, this emulator bug is really annoy me.

The problem answered when I put Armeabi-v7a as engine, the app is running perfectly. So the answer is not by upgrading AIR SDK but pushing emulator to specifically runs on armeabi-v7. Put AIR on that CPU, and the app will run as we expected.

Why I can't come with this answer previously is that because I want to run the app on minimum OS Android 2.3, and Android AVD doesn't give you an option to choose engine type on that OS version, at least not anymore once you equip yourself with all those available AVD presets. Default CPU is ARM for any OS version lower than 4.0.

Long story short, now I continue debugging my app on emulator smoothly as before.