Decompile Android apps, lower permissions to advertise and re-sign

Source: Internet
Author: User

Features: Anti-compilation APK reduced permissions and re-signing

Scenario: Many software applications that may cause charges (such as texting, calling numbers) or disclosing privacy (such as reading a newsletter) are not reassuring. For example: fetion, ink weather, ireader, etc. are listed in this column. In order to be able to use with ease, need to do some hack work, reduce the permissions of the application, limit its operation.

Tool: apktool-install-windows-2.2_r01-3.tar.bz2 (http://code.google.com/p/android-apktool/downloads/list)

Tools: (JDK) Keytool.exe generate signed KeyStore

Tools: (JDK) Jarsigner.exe used to sign apk

Tools: (optional) D:\android-sdk-windows\tools\zipalign.exe is optimized for packaged applications, making the interaction between Android and applications more efficient at run time.

Operation:

1, anti-compilation apk file demo.apk to demo directory

Apktool.bat D demo.apk Demo

2, modify ...

2.1 Reduced permissions: Modify the demo directory Demoandroidmanifest.xml file, locate the label, and comment out the unwanted permissions. (Reference: Http://hb.qq.com/a/20101115/001156.htm developer must not know the Android permission description)

2.2 Remove ads: such as Smart Monitor pro_2.3.16.apk

Android:layout_width= "Fill_parent"

android:layout_height= "Wrap_content"

app:keywords= "Girl Friends monitor Women Sex

Adult gift Electron Wallpaper ring

Shirt Android Application Game

Sport Football Soccer World Cup "

/>

Switch

Android:layout_width= "Wrap_content"

android:layout_height= "Wrap_content"

Android:width= "1dip"

android:height= "1dip" app:keywords= ""/>

2.3 Remove ads: like hi-msn.apk

Android:layout_width= "Fill_parent"

android:layout_height= "Wrap_content"

Android:layout_alignparentbottom= "true"/>

Switch

Android:layout_width= "Fill_parent"

android:layout_height= "Wrap_content"

Android:layout_alignparentbottom= "true"

Android:width= "1dip"

android:height= "1dip"/>

3. Re-compile the demo directory into an apk file

Apktool.bat B Demo

4, locate the Demo\dist directory under demo.apk renamed DEMO_UNSIGN.APK

5, (optional) Modify the contents of the Apksigner.input.txt file to generate key pairs and certificates, and to sign the APK. If it already exists, you do not need to modify it. (Modify Apksigner.bat to remove comments from the downstream)

Type Apksigner.input.txt | Keytool-genkey-alias%jks%-keystore%jks%-storepass%pwd%-keypass%pwd%-keyalg rsa-validity 20000

6, after modifying the settings in the Apksigner.bat script (set App=demo), execute apksigner.bat to demo_unsign.apk signature, generate demo_signed_final.apk file.

7. Remove the original APK app on your phone and reinstall demo_signed_final.apk

----------------------------------------# # Apksigner.bat file

@rem # # Apksigner.bat

@rem http://www.cnblogs.com/qianxudetianxia/archive/2011/04/09/2010468.html Android Learning Series (1)-Sign the app (sign for APK)

@rem http://www.blogjava.net/zhaojianhua/archive/2011/06/23/352887.html Android APK Signature

@set Jks=android.keystore

@set pwd=111111

@set App=demo

@set apk0=%app%_unsign.apk

@set out1=%app%_signed.apk

@set out2=%app%_signed_final.apk

@rem Type Apksigner.input.txt | Keytool-genkey-alias%jks%-keystore%jks%-storepass%pwd%-keypass%pwd%-keyalg rsa-validity 20000

@if exist%out1% del%out1%

@if exist%out2% del%out2%

@echo ##########################

@echo # # # signer.0 # #%APK%.APK

@echo ##########################

@jarsigner. Exe-verbose-keystore%jks%-storepass%pwd%-keypass%pwd%-signedjar%out1%%apk0%%JKS%

@jarsigner. Exe-verify%out1%

@echo ##########################

@echo # # # Signer.1 # #%out1%

@echo ##########################

@d:\android-sdk-windows\tools\zipalign.exe-v 4%out1%%out2%

@jarsigner. Exe-verify%out2%

@echo ##########################

@echo # # # signer.2 # #%out2%

@echo ##########################

@pause

----------------------------------------apksigner.input.txt File

Username

Org

Org

Beijing

Beijing

cn

Y

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.