Take a sit and watch!
Monday, May 26, 2014
Run A Simple Webserver From Active Directory Of Your Mac
Problem
I need to run a simple HTTP server to check whether my angular.js app is running perfectly as the example says. It just need to serve the file I need with no platform or security concerns.
Solution
By googling, I hit simple command from lifehacker.com that will make my life easier.
From the terminal, traverse to the designated directory and type these:
python -m SimpleHTTPServer 8000
The last portion of the command is the target port where our server will responds. We should set this new server on an empty port.
Now I am ready to test my app.
source
Monday, April 14, 2014
Resign an APK File With New Certificate
Problem:
We have an apk file that is modified and signed by co-developer and want to publish it as an update of existing application in the Google Play.
Google Play rejects the new update as it signed using a different certificate.
Solution:
Resign the file using the old certificate.
If you work on mac this problem is solved easily using this few line of shell script as following.
zip -d new-apk.apk META-INF/\* jarsigner -verbose -storetype pkcs12 -keystore old-cert.pfx -storepass old-cert-password new-apk.apk old-cert-alias jarsigner -verify new-apk.apk /AndroidSDKPath/tools/zipalign -v 4 new-apk.apk new-apk-aligned.apk
And presto! A modified apk signed with old certificate.
What it does is strip META-INF directory from the apk file, sign and verify the apk, and the last is zipalign the apk.
Monday, February 3, 2014
Flushing Out SWF And AIR Versions From Memory
While working with amxmlc and adt command line from Flex and AIR SDK, I always have to seek this version number to get the correct pair of Flash Player version and AIR version.
Tired of looking for this list on google. I'll keep the table of swf compiler option, Flash Player, and AIR version at here.
Compiler Option
|
Flash Player Version
|
AIR version
|
-swf-version=9
|
9.0
|
N/A
|
-swf-version=10
|
10.0, 10.1
|
1.5, 2.0
|
-swf-version=11
|
10.2
|
2.6
|
-swf-version=12
|
10.3
|
2.7
|
-swf-version=13
|
11.0
|
3
|
-swf-version=14
|
11.1
|
3.1
|
-swf-version=15
|
11.2
|
3.2
|
-swf-version=16
|
11.3
|
3.3
|
-swf-version=17
|
11.4
|
3.4
|
-swf-version=18
|
11.5
|
3.5
|
-swf-version=19
|
11.6
|
3.6
|
-swf-version=20
|
11.7
|
3.7
|
-swf-version=21
|
11.8
|
3.8
|
-swf-version=22
|
11.9
|
3.9
|
-swf-version=23
|
12
|
4
|
-swf-version=24
|
13
|
13
|
-swf-version=25
|
14
|
14
|
-swf-version=26
|
15
|
15
|
source taken from here
Additionally the command to build an swf is as below
-sp ./src ./libsrc \
-el /AIRSDK/frameworks/libs/air/airglobal.swc \
-l ./lib/ ./libext \
-show-actionscript-warnings=false \
-swf-version=23 \
-compress=true \
-frame=MovieClip,GameManager \
-debug=true \
-use-network=true \
-o game-android.swf ./src/Preloader.as
And the command to build apk from that swf is as below
/AIRSDK/bin/adt \
-package \
-target apk-captive-runtime \
-storetype pkcs12 \
-keystore certificate_here.pfx \
-storepass certificate_pass_here \
target_name.apk target_name-app.xml \
-platformsdk /AndroidSDK/android-sdk-macosx \
-extdir ./ane \
-C ./ \
game-android.swf \
Default.png \
Default@2x.png \
Default-568h@2x.png \
Default-Landscape@2x~ipad.png \
Default-Landscape~ipad.png \
Default-Portrait@2x~ipad.png \
Default-Portrait~ipad.png \
./img/cc_29.png \
./img/cc_57.png \
./img/cc_72.png \
./img/cc_114.png \
./img/cc_144.png \
./img/cc_512.png \
./img/cc_1024.png
And to check if device ready before install apk to device
/AndroidSDK/android-sdk-macosx/platform-tools/adb \
devices
And to install apk file to device
/AndroidSDK/android-sdk-macosx/platform-tools/adb \
install \
-r ~/Work/puzzle/target_name.apk
And last but not least is run that installed apk
/AndroidSDK/android-sdk-macosx/platform-tools/adb shell 'am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -n air.put.app.id/.AppEntry'
Put everything in one shell-command-file.sh and you are ready to roll.
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.
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.
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
$ ./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.
Subscribe to:
Posts (Atom)



