Monday, September 23, 2013

Decompile APK

1. Change .APK to .ZIP and unzip it. There is classes.dex in the folder.
2. Download dex2jar(http://code.google.com/p/dex2jar/) to convert classes.dex to classes.
     . dex2jar.sh PATH_TO_CLASSES_DEX/classes.dex
    
    The command should generate classes_dex2jar.jar
3. Download jdgui(http://mac.softpedia.com/dyn-postdownload.php?p=48710&t=4&i=1) to unzip jar file.
    Open jdgui and choose classes_dex2.jar.jar.  All folder and java file should be browsed in JDGUI.  
    Save all source.

4. Download android-apktool(https://code.google.com/p/android-apktool/downloads/list). Choose "apktool1.5.2.tar.bz2" and "apktool-install-macosx-r05-ibot.tar.bz2"(This depends on platform).
    . apktool d PATH_TO_APK/xxx.apk
   All resource and xml file are generated in APK_NAME folder

Friday, June 14, 2013

Compile Android Apps

Command
1. make: compile all Android system
2. make [package name]: the package name can be found in packages/apps/xx/Android.mk
    or
    mmm packages/apps/Package_name
    The APK and odex will generate in out/target/product/generic/system/app/xxx.apk

3. make snod: this command will regenerate system.img
4. Remove default sign key
 
   zip –d xxx.apk META-INF/*

Put 3rd apk into system.img
1. put apk into out/target/product/generic/system/app/
2. make snod


Tuesday, May 28, 2013

Run GCM demo by app engine server

GCM api
1. Create google api project about GCM
2. Create server key. This api key will be used fot setting up server application.

Create App Engine project
1. Apply one project in app engine. Input project name and project url name.
    Peoject url name will be used in Android application.
2. Download App engine SDK for JAVA

  
Set up Server Application
1. Android SDK Manager, install Extras > Google Cloud Messaging for Android Library.
2. In a text editor, edit PATH_TO_ANDOIRD_SDK/extras/google/gcm/samples/gcm-demo-appengine/src/com/google/android/gcm/demo/server/ApiKeyInitializer.java and replace the existing text with the API key obtained above.
3. In a shell window, go to the PATH_TO_ANDOIRD_SDK/extras/google/gcm/samples/gcm-demo-appengine directory.
4. ant -Dsdk.dir=PATH_APP_ENGINE_SDK/appengine-java-sdk-1.8.0/ compile
    It will generate WebContent/. The code will be upload to App engine, so we don't need to launch server in our local side.

Upload Server Application to App Engine
1. From the appengine-java-sdk directory, run:
     bin\appcfg.cmd update PATH_TO_ANDOIRD_SDK/extras/google/gcm/samples/gcm-demo-appengine/WebContent/
2. Open http://appspot.com 
3. It should show "no devices registered" page.

Set up Android Application
  1. Using a text editor, open PATH_TO_ANDOIRD_SDK/extras/google/gcm/samples/gcm-demo-client/src/com/google/android/gcm/demo/app/CommonUtilities.java and set the proper values for the SENDER_ID and SERVER_URL constants.
  2. In a shell window, go to the gcm-demo-client directory.
  3. Use the SDK's android tool to generate the ant build files:
  4. android update project --name GCMDemo -p . --target android-16
4. ant clean debug
5. It will generate GCMDemo-debug.apk in bin/ folder
6. Install APK in devices.
7. Done.