APK (Android package) is our Android installation file, you can open the installation in the simulator and the phone directly, packaging the APK from the project there are several ways desirable
The simplest method (similar to our winfrom)
As long as we debug or run the project, under the Project Bin Debug has the same name apk file (Eclipse) is like this. It turned into \app\build\apk under Android.
Of course we can't put this apk in the store. No signature will be replaced by someone else's apk
Ii. Signature Release
1. The meaning of the signature
In order to guarantee the legal ID of each application developer, it is possible to prevent some open vendors from confusing the installed program by using the same package name
We need to uniquely sign our release APK file to ensure consistency for each release we publish (such as Automatic Updates will not be installed because of inconsistent versions).
2. Procedure for signing
A. Creating a key
B. Sign the APK using the key generated in step a
Let's look directly at how Android studio packs a signed apk, which may be a little different from eclipse
(1) Android Studio menu Build->generate signed APK
(2) Create a new key
- Key Store Path: The address of the KeyStore file
- Password/confirm: Password for KeyStore
- Key:
- Alias: Key Name
- Password/confirm: Key Password
- Validity (years): Key validity time
- First and last name: Key issuer Name
- Organizational Unit: Key-issuing organization
- City or Locality: cities
- Country Code (XX): Country
(3) Next step
(4) Select the packaged path OK
Third, anti-compilation (organized in the network)
The generated apk is directly unzipped.
Is the lack of the source part. The source part is classified into Classes.dex, the R class has become RESOURCES.ARSC.
Here's a look at how to decompile these 2 files
The first thing to download is two tools: Dex2jar and Jd-gui
The former converts the Classes.dex in the apk into a jar file, and Jd-gui is an anti-compilation tool that can view the source code of the jar package directly. The following are:
Dex2jar:http://laichao.googlecode.com/files/dex2jar-0.0.7-snapshot.zip
Jd-gui:http://laichao.googlecode.com/files/jdgui.zip
Specific steps:
First, the APK decompression, get the Classes.dex, it is Java file compilation and then through the DX tool packaging;
Unzip the downloaded Dex2jar and copy the Classes.dex to the directory where Dex2jar.bat is located. Navigate to the directory where the Dex2jar.bat is located at the command line
Run
Dex2jar.bat Classes.dex
Generated
Classes.dex.dex2jar.jar
The following are the generated jar files:
Run Jd-gui (jd-gui.exe), open the jar package generated above, you can see the source code