I'm using ApkTool to decode AndroidManifest.xml
inside an APK file and it works perfectly but how can I encode it again ,the same way it was encoded before, after applying some changes? For example (in my case) changing the app label.
You may use apktool again to create a new APK file including your changed AndroidManifest.xml
.
First, decompile the APK file:
java -jar apktool.jar decode app.apk app
Then modify the files you want in the app
directory and recompile it back into a new APK:
java -jar apktool.jar build app app_new.apk
aapt
must be on our PATH
or use the --aapt
option to specify the location of the executable. Otherwise apktool will fail when rebuilding the APK.
Note: The rebuilt APK is neither signed nor zipaligned, just repackaged. Take a look at this website for details about signing and aligning your new APK.
apktool
often fails to decompile then recompile with no modifications. –
Sharpfreeze Input file (app) was not found or was not readable.
error. What does it mean ? If I omit last parameter I cannot build apk again. –
Karlotte Use appt for android-sdk (ex:- /build-tools/27.0.3/aapt )
./aapt d xmltree ./debug.apk AndroidManifest.xml
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=1)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="1.0" (Raw: "1.0")
A: package="com.example.activity" (Raw: "com.example.activity")
E: uses-sdk (line=6)
A: android:minSdkVersion(0x0101020c)=(type 0x10)0x8
A: android:targetSdkVersion(0x01010270)=(type 0x10)0xf
E: application (line=8)
A: android:label(0x01010001)=@0x7f030000
A: android:icon(0x01010002)=@0x7f020000
E: activity (line=10)
A: android:label(0x01010001)=@0x7f030000
A: android:name(0x01010003)=".SampleActivity" (Raw: ".SampleActivity")
E: intent-filter (line=12)
E: action (line=13)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")
E: category (line=14)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
This link might help http://elinux.org/Android_aapt
Another one tool for "AXMLPrinter" google source link https://code.google.com/archive/p/android4me/downloads
java -jar ./AXMLPrinter2.jar ./debug.apk_FILES/AndroidManifest.xml
© 2022 - 2024 — McMap. All rights reserved.