2012年8月21日 星期二

Get Android source code from .apk

To get Android source code from .apk, you need following tools:

  1. dex2jar - the tool helps we decode .apk to .class files
  2. JD-gui or JDEclipse - the tool helps we read the .class files. JD-gui can help you save all .class to .java at one time.
  3. android-apktool - the tool helps we get res and other properties in the .apk.

The steps to get the source code of XXX.apk:

The environment I used is Fedora 16. android-apktool was installed under /usr/local/bin directory.

First, we are going to take the .java files.
     1.  Use dex2jar to get the .class files.
          # sh dex2jar.sh XXX.apk
     Then we will get a file named "XXX.apk.dex2jar.jar". 
     2. Open JD-gui and open "XXX.apk.dex2jar.jar" file. (File -> OpenFile -> indicate XXX.apk.dex2jar.jar ).
     3. Save all sources (File -> Save all sources -> to where you want to save the sources and make a name). Then you will get a zip file. Here we named it XXX.zip.

Now we have .java files in XXX.zip.
     
Second, we are going to get other files such as res directory and .xml files in XXX.apk.
     1.  Use android-apktool to get the files.
           # apktool d XXX.apk XXX_dir
     apktool will create XXX_dir. Then in XXX_dir, we have the files. 
     
Finally, we can unzip XXX.zip to XXX_dir/src. And everything is done.

References:

2012年6月1日 星期五

Set up a CloudStack development Environment

I. Set up the development environment
Following are a brief steps of setting up CS development Environment. For the detail steps, check Citrix document 132013.
  1. Install Java JDK.
  2. Install Apache TomCat. (Avoid Tomcat 6.0.35, since it has some problem with CloudStack).
  3. Install Apache ANT.
  4. Install git.
II. Use Eclipse to develop

Import CS src to Eclipse:
Since CloudStack uses Java, it's easier to use Eclipse to develop our own program. After done the first part, all we need to do is to import the CS source code to Eclipse. Check the importing source to Eclipse part of CloudStack document.

Import Eclipse preference:
CloudStack provides the Eclipse preference, just download the attachment in the article, and import it into Eclipse. File->import->General->Preferences->the download file location.

III. Errors in Eclipse:
After CS src was imported to Eclipse, there are many errors. most of them is because awsapi this project. 
awsapi project missed its Libraries. We just need to add the missed jars to it. The missed jars are in project deps/awsapi-lib. Add all jars in awsapi project, then lots of errors can be solved.

For other errors, still checking...

2012年5月30日 星期三

Install Openstack Swift.

References:
More information: