HOW TO: APKTOOL
Firstly, the most basic thing you will need to learn how to use if Apktool, without it modding apks is more or less impossible. Read the following:
What is Decompiling?
Android apps are basically made up of Java codes and XML files. After compiling the app, these files cannot be viewed. Decompiling is a process which decompiles the binary form of XMLs and .Java files into readable form. The XML files can be retained as it is, but the .java files are converted into smali files, a totally different language.
What is Recompiling?
Recompiling is simply a way to convert the XML and smali files back into the binary form and building up of the APK with the changes made. All apps after recompiled have to be signed (except system apps).
Now, pick your operating system and let's get started.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Firstly, you will need to download Apktool from here and it's depidencies and helpr script from here finally install Java from here.
Install Java before continuing.
Next, create a folder in your main drive and label it 'apktool' for easy access and extract the files in the above packages there.
Now your mainly set up, congrats. Now you can add the apks you may want to modify in the folder. But note, when modifying system apps from a rom you will need to install its framework-res.apk first, or decompile / compiling will give errors.
If you want to modify, open up the apktool folder you create, in it, hold shift and right click, then choose 'open command window'. In the cmd window these are the commands you will want to use.
Installing framework-res.apk.
Code:
apktool if framework-res.apk
Decompiling apk. (Replace name_of_app, with the name of the apk you are trying to decompile).
Code:
apktool d name_of_app.apk
Compiling apk. (Replace name_of_folder with the the name of the folder in which your apk was decompiled, don't add .apk extension here)
Code:
apktool b name_of_folder
Install Java, by running the following commands in Termianl, one by one.
Code:
sudo add-apt-repository ppa:ferramroberto/java
sudo apt-get update
sudo apt-get install sun-java6-jre sun-java6-plugin
sudo apt-get install sun-java6-jdk
Next download Apktool from here and Linux specific dependencies from here.
Extract them to the desktop and open up Terminal and cd to the Destkop
Code:
cd ~/Desktop
Once there, run the following commands one by one to set permissions. (Replace emwno with your username and hit enter after every command)
Code:
chown -R emwno '/home/emwno/Desktop/apktool.jar'
chown -R emwno '/home/emwno/Desktop/
chown -R emwno '/home/emwno/Desktop/apktool
Next make all 3 files executable by doing the same thing one at a time pressing enter after each command. (Replace emwno with your username)
Code:
sudo chmod +x '/home/emwno/Desktop/apktool.jar'
sudo chmod +x '/home/emwno/Desktop/aapt'
sudo chmod +x '/home/emwno/Desktop/apktool'
Next we need to move these files to the bin folder. Run the following in the same terminal.
Code:
gksudo nautilus
A new window should pop up, from the left navigate to "filesystem/usr/local/bin drag all three files from your Desktop into the bin folder and then close it.
Congrats, now your set up to use Apktool, from the Terminal!
Now, if you want to modify an apk. Open up Terminal, cd to the apks directory and run the following accordingly. But note, you will need framework-res.apk when modifying system apps from a specific rom.
Installing framework-res.apk.
Code:
apktool if framework-res.apk
Decompiling apk. (Replace name_of_app, with the name of the apk you are trying to decompile).
Code:
apktool d name_of_app.apk
Compiling apk. (Replace name_of_folder with the the name of the folder in which your apk was decompiled, don't add .apk extension here)
Code:
apktool b name_of_folder
Before continuing, install java from here.
Next download Apktool from here and MacOS specific dependencies from here.
Unpack both to /usr/local/bin directory (you must have root permissions to do so).
Congrats, now your set up to use Apktool, from the Terminal!
Now, if you want to modify an apk. Open up Terminal, cd to the apks directory and run the following accordingly. But note, you will need framework-res.apk when modifying system apps from a specific rom.
Installing framework-res.apk.
Code:
apktool if framework-res.apk
Decompiling apk. (Replace name_of_app, with the name of the apk you are trying to decompile).
Code:
apktool d name_of_app.apk
Compiling apk. (Replace name_of_folder with the the name of the folder in which your apk was decompiled, don't add .apk extension here)
Code:
apktool b name_of_folder
Configuring sdk and adb
HOW TO: SDK / ADB
The Android SDK, provides the necessary tools for building apks, as well as providing API's. And the ADB! Is a mean of connect to the device via root stoarge, thus modifying system files, this is a must for devs, who would like to test out their new frameworks etc.
Now, pick your operating system and let's get started.
Before we continue, you will require ADB drivers for your device, use this to download them.
Then extract it's components to your main drive, for example C:\android-sdk
After extracting, open the folder, then navigate to platform-tools. There open the command prompt, by holding shift key, then right clicking, then hit 'Open command window here'.
Type 'adb' in command prompt. If adb executes means u have successfully setup adb.
If not already, open up the Android SDK, CHECK Android SDK Tools and Android SDK Platform-Tools and download them.
Download the Android SDKTools for Linux, keeping in mind which bit you have, for example 32bit or a 64bit system.
Next extract the folder in your home directory (/home/username).
Now to be able to run the SDK you need to make it executable. First of all go to home/username/android-sdk-linux/tools/ (Where's it's your username and android-sdk-Linux is the extracted folder. Right click on a file called 'android' then hit properties! Then in the new window, goto the permissions tab. CHECK 'Allow executing file as program'. Once done, close it and double click the android file. And select 'Run in Terminal'.
Once done, check Android SDK Tools and Android SDK Platform-Tools and download them.
Now that you have the SDK, let's configure ADB for ease of access. Open up Terminal and type the following:
Code:
sudo gedit ~/.bashrc
Next in the newly opened window, paste this to the very bottom of the file, save and close.
Code:
# Android tools
export PATH=~/android-sdk-linux/platform-tools:~/android-sdk-linux/tools:$PATH
Now just simply reload your bashrc, by entering this in Terminal.
Code:
source ~/.bashrc
Download the Android SDKTools for Mac.
Next extract the folder in your home directory (/home/username).
Now to be able to run the SDK you need to make it executable. First of all go to home/username/android-sdk-linux/tools/ (Where's it's your username and android-sdk-Linux is the extracted folder. Right click on a file called 'android' then hit properties! Then in the new window, goto the permissions tab. CHECK 'Allow executing file as program'. Once done, close it and double click the android file. And select 'Run in Terminal'.
Once done, check Android SDK Tools and Android SDK Platform-Tools and download them.
Now that you have the SDK, let's configure ADB for ease of access. Open up Terminal and type the following:
Code:
nano ~/.bash_profile
The above command will open a file in a text editor, now add the following line in the end of that file.
Code:
export PATH=${PATH}:~/android-sdk-linux/platform-tools:~/android-sdk-linux/tools
Save the file and close it. Now run this in the Terminal window:
Code:
source ~/.bash_profile
Congrats, you have successfully set up SDK and ADB on your Mac!.
Enable 'USB Debugging' on your phone. Now to check if your phone is connected, run the following command in Terminal or CMD.
Code:
adb devices
Then you should see something like: (Where abc is your devices number)
Code:
list of attached devices
abc device
Next, to pull things from your device, you need to run the following command
Code:
adb pull (Directory of the file you want on phone)
-----For Example-----
adb pull /system/app/systemui.apk
To push things to your phone, you will need to run the following command:
Code:
adb push (Directory of file on your PC) ( Directory to where you want to push the file on phone)
-----For Example-----
adb push C:\users\emwno\flymeos.zip /sdcard/roms
You can also install APK's form your PC directly to phone by using these commands:
Code:
adb install (Directory of the apk on your PC)
-----For Example-----
adb install C:\users\emwno\apk\mms.apk
BASIC MODDING
Firstly, you will need Apktool setup, if you haven't set it up, refer to Post # 1.
Choose you manufacturer for the next step:
-SONY
Sony device will have to instal, both framework-res.apk and SemcGenericUxpRes.apk before compiling or decompiling apks to avoid errors.
-SAMSUNG
Samsung device users will have to install both framework-res.apk and twframework.apk to avoid errors while compiling or decompiling.
-HTC
Htc device users will also have to install both framework-res.apk and framework-htc-res.apk to avoid errors (NOTE: Name of HTC framework may vary)
To edit or modify XMLs in a decompiled apk,
-Windows Users should use this.
-Mac and Linux users won't need any special editor.
—————————————————————————————————————————
Now pick your poison and get started!
> Changing Carrier Label
First you need to decompile your SystemUI.apk.
Open up res/layout/status_bar_tracking.xml and find this:
Code:
<com.android.systemui.statusbar.phone.CarrierLabel android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="#ff33b5e5" android:gravity="center" android:layout_gravity="bottom" android:paddingBottom="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" />
And replace it with this:
Code:
<textView android:text="@string/carrier_label" android:textAppearance="@style/TextAppearance.StatusBar.Clock" android:textColor="#ff33b5e5" android:gravity="center" android:layout_gravity="bottom" android:paddingBottom="20.0dip" android:layout_width="fill_parent" android:layout_height="wrap_content" />
Save and close.
Now open up res/values/strings.xml and add this line in the end above </resources>.
Code:
<string name="carrier_label">ENTER_DESIRED_LABEL_HERE</string>
Now replace 'ENTER_DESIRED_LABEL_HERE', with the carrier label you want to keep. Then save it, and close the editor.
Now rebuild systemui with Apktool. No your not done yet.
Open up the newly built systemui.apk and the previous one with either WinRAR or 7zip and copy over the META-INF folder form the previous one to the newly built one. Then read Post # 2 and push the apk to /system/app.
> Semi-Transparent Notification drawer
Firstly decompile systemui.apk
Then navigate to smali\com\android\system ui\statusbar\phone then find and open PhoneStatusBar$FastColorDrawable.smali.
Find this line:
Code:
iget v0, p0, Lcom/android/systemui/statusbar/phone/PhoneStatusBar$FastColorDrawable;->mColor:I
And replace it with:
Code:
const v0, 0x7a000000
Recompile systemui. But your not done yet. Open up the newly built systemui.apk and the previous one with either WinRAR or 7zip and copy over the META-INF folder form the previous one to the newly built one. Then read Post # 2 and push the apk to /system/app.
Extra res for future guide requests
Last one.
Great guide!
EDIT2: U can extract more ideas like clock centering from here those are useful, hope it helps
EDIT3: Same error for me again edditing carrier name....
1. from platform-tools I extracted systemUI.apk, framework-res.apk and SemcGenericUxpRes.apk
Code:
adb pull systemUI.apk
adb pull framework-res.apk
adb pull SemcGenericUxpRes.apk
2. I moved them to C:/apktool
I installed sources
Code:
apktool if framework-res.apk
apktool if SemcGenericUxpRes.apk
3. I decompiled
Code:
apktool d SystemUI.apk SystemUI
4. I eddited (as is teached in the guide step by step)
5. I recompilled
Code:
apktool b SystemUI
AND....
Code:
C:\apktool>apktool if framework-res.apk
I: Framework installed to: C:\Users\Luis\apktool\framework\1.apk
C:\apktool>apktool if SemcGenericUxpRes.apk
I: Framework installed to: C:\Users\Luis\apktool\framework\2.apk
C:\apktool>apktool d SystemUI.apk
I: Baksmaling...
testI: Loading resource table...
I: Loaded.
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: C:\Users\Luis\apktool\framework\1.apk
I: Loaded.
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Done.
I: Copying assets and libs...
C:\apktool>apktool b SystemUI
I: Checking whether sources has changed...
I: Smaling...
I: Checking whether resources has changed...
I: Building resources...
invalid resource directory name: C:\apktool\SystemUI\res/drawable-sw600dp-hdpi
invalid resource directory name: C:\apktool\SystemUI\res/layout-sw600dp
invalid resource directory name: C:\apktool\SystemUI\res/values-sw600dp
invalid resource directory name: C:\apktool\SystemUI\res/values-sw600dp-port
invalid resource directory name: C:\apktool\SystemUI\res/values-sw720dp
invalid resource directory name: C:\apktool\SystemUI\res/values-sw720dp-port
Exception in thread "main" brut.androlib.AndrolibException: brut.common.BrutExce
ption: could not exec command: [aapt, p, --min-sdk-version, 15, --target-sdk-ver
sion, 15, -F, C:\Users\Luis\AppData\Local\Temp\APKTOOL4843747841851029423.tmp, -
I, C:\Users\Luis\apktool\framework\1.apk, -S, C:\apktool\SystemUI\res, -M, C:\ap
ktool\SystemUI\AndroidManifest.xml]
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:255)
at brut.androlib.Androlib.buildResourcesFull(Androlib.java:324)
at brut.androlib.Androlib.buildResources(Androlib.java:269)
at brut.androlib.Androlib.build(Androlib.java:192)
at brut.androlib.Androlib.build(Androlib.java:174)
at brut.apktool.Main.cmdBuild(Main.java:188)
at brut.apktool.Main.main(Main.java:70)
Caused by: brut.common.BrutException: could not exec command: [aapt, p, --min-sd
k-version, 15, --target-sdk-version, 15, -F, C:\Users\Luis\AppData\Local\Temp\AP
KTOOL4843747841851029423.tmp, -I, C:\Users\Luis\apktool\framework\1.apk, -S, C:\
apktool\SystemUI\res, -M, C:\apktool\SystemUI\AndroidManifest.xml]
at brut.util.OS.exec(OS.java:83)
at brut.androlib.res.AndrolibResources.aaptPackage(AndrolibResources.jav
a:253)
... 6 more
C:\apktool>
Any idea?
Hmm. What an auspicious wall of writing xD
Sent from Xperia Arc S
best guyde to install Android sdk for linux
-Android SDK:
Download the SDK here: http://developer.android.com/sdk/index.html
Extract the SDK and place it in your home directory.
I renamed my SDK to android-sdk to make it easier to navigate to.
Go to your home folder, press Ctrl+H to show hidden files, and open up your .bashrc file.
Add these lines at the bottom of the file:
Code:
# Android tools
export PATH=${PATH}:~/android-sdk/tools
export PATH=${PATH}:~/android-sdk/platform-tools
export PATH=${PATH}:~/bin
Find your .profile file and add this at the bottom of the file:
Code:
PATH="$HOME/android-sdk/tools:$HOME/android-sdk/platform-tools:$PATH"
You have now successfully installed the Android SDK.
To check for updates issue this into your terminal:
Code:
$ android
luiseteyo said:
Any idea?
Click to expand...
Click to collapse
i got that once. fix it by updating the tools: apktool.jar, aapt
n1kolaa said:
best guyde to install Android sdk for linux
Click to expand...
Click to collapse
i guess so.
emwno said:
i got that once. fix it by updating the tools: apktool.jar, aapt
Click to expand...
Click to collapse
But the ones provided by u are the last ones. Where can I update them? here?
luiseteyo said:
But the ones provided by u are the last ones. Where can I update them? here?
Click to expand...
Click to collapse
sorry, i meant to say that try an older version.
emwno said:
sorry, i meant to say that try an older version.
Click to expand...
Click to collapse
What version do u use for ICS apks.?? There is people that uses 1.4.2 for decompile and 1.4.3 to recompile...
luiseteyo said:
What version do u use for ICS apks.?? There is people that uses 1.4.2 for decompile and 1.4.3 to recompile...
Click to expand...
Click to collapse
i uae 1.4.2 for everything, on ics.
Still don't working... I don't understand anything... if u or jader could guide me.. would be very grateful
luiseteyo said:
Still don't working... I don't understand anything... if u or jader could guide me.. would be very grateful
Click to expand...
Click to collapse
try this aapt. http://www.mediafire.com/?0q52u6v8vdkpq1i
Still nothing... using 1.4.2 to decompile and recompile or either using 1.4.3 to recompile... I am going to suicide
I'm using apktool v1.5.0 and Fast AAPT. Works like a charm!
Here are the links:
[UTIL][Sept 2 2012] Apktool v1.5.0 - a tool for reverse engineering apk files
[DevTOOL][2012-10-01] Fast AAPT (#2) - Speed up Eclipse/apktool/etc
But did u try to decompile or recompile settings or systemui? dont u have my error?
Still nothing with that configuration... It has something to do to my java environment. I am sure... Thank u!
luiseteyo said:
Still don't working...
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=19944251#post19944251
thank you for guide. I want to add something.
-Use latest aapt (apktool.jar etc.).
-I suggest you, right click to apk via 7zip, drag&drop classes.dex to pc and delete inside it. Decompile-do your moddings-compile. drag&drop files which u changed from unsigned to signed and put classes.dex back to original apk again.
-Check log for mistakes especially .9.png errors. They causes problems while compiling.
- If u mod .smali files, check google smali & baksmali jar files. and use that..
-For latest apks apktool/manager heapsize 64mb may not be enough for larger apks. Change it to least 512MB..
-Some apk files compiling problems can be solved like editing styles.xml..
Check xda topic..
happy moddings..
Related
I'm trying to create an update.zip that will install a Koodo radio on my SGH-i757m since I have switched from Bell. I took DSIXDA's original Bell Modem update for the i757m and replaced the MDM/AMSS files from the stock SGH-T989D rom from Koodo. I see that the manifest's contain SHA-1 keys relating to the files. Is that another step to create those or is that what happens during APK signing?
Judging by the output of the SignApk.jar it looks like I'm missing something from the JDK but I can't figure out what.
I followed these instructions :
1. You need to download the SignApk.jar - This is the tool that signs the file download from here - a mediafire link I found on xda. Unzip the file to a convenient location, you only need the SignApk.jar that you'll find inside.
2. You will also be using OpenSSL, so head over here and download the zip on the side for your iteration of windows (32 or 64 bit).
2. Place the zip on your desktop and unzip it.
3. You have to execute these commands in command prompt:
Code:
cd location_of_openssl_folder\bin
openssl genrsa -out key.pem 1024
openssl req -new -key key.pem -config location_of_openssl_folder\openssl.cnf -out request.pem
openssl x509 -req -days 9999 -in request.pem -signkey key.pem -out certificate.pem
openssl pkcs8 -topk8 -outform DER -in key.pem -inform PEM -out key.pk8 -nocrypt
That will work. Your certificate.pem and key.pk8 will be located in the \bin folder.
4. Now, take the key.pk8 file found in the \bin folder and the certificate.pem file found also in the \bin folder and place then in the folder containing your SignApk.jar (it will overwrite the other files found in the folder, its ok).
Click to expand...
Click to collapse
After trying to sign the zip using the command:
Code:
$ java -jar SignApk.jar key.pem key.pk8 KoodoRadio.zip Update.zip
I get:
Code:
java.security.cert.CertificateParsingException: signed overrun, bytes = 463
at sun.security.x509.X509CertImpl.parse(Unknown Source)
at sun.security.x509.X509CertImpl.<init>(Unknown Source)
at sun.security.provider.X509Factory.engineGenerateCertificate(Unknown Source)
at java.security.cert.CertificateFactory.generateCertificate(Unknown Source)
at com.android.signapk.SignApk.readPublicKey(SignApk.java:75)
at com.android.signapk.SignApk.main(SignApk.java:318)
Hi people!!
I followed some tutorials to try to customize my WhatsApp app, just wanted to change the icon to start.
I'm doing this, I put whatsapp.apk inside apktool directory and this to cmd:
Code:
apktool.bat d WhatsApp.apk app
this makes a folder app that inside have de decompiled code of whatsapp and works ok.
Then, i go to res, and open icon.png, make a color change, and then save changes.
So, when I'm trying to recompile with:
Code:
apktool.bat b c:\apktool\app whats.apk
fails and shows this:
Code:
I: Building resources...
c:\apktool\app\res\layout-large\abs__action_mode_close_item.xml:5: error: No res
ource identifier found for attribute 'textAllCaps' in package 'android'
.....
And more errors.
It's the first app I'm trying to decompile, i have the latest android sdk-apktool and java jdk.
Thanks You.
Hello there, as of late, I've been trying to exploit the Settings.APK on the HTC One M9 (specifically the verizon version, although the APKs are the same there is just a value on the device itself that is different which triggers the "block" on the APK), as you can see here:
http://forum.xda-developers.com/ver...verizon-enable-oem-lock-t3281994#post64568917
I've discovered that it is possible to patch/overwrite the existing Settings.APK with adb install -r -d (overwrite and downgrade), even a modified one I've worked on with APKTools (without root). However, I've run into several issues, mainly modifying the java code and getting it to recompile (with the APK Multi-Tool I'm using to compile "system APK files) WITH the apk.
What I mean to say is that when I place the java code in /src it will compile but I don't see the changes taking effect.
EDIT: Now when I try to compile I get an error.
Code:
Building Apk
I: Using Apktool 2.0.1-825476-SNAPSHOT
I: Checking whether sources has changed...
I: Building java sources...
"An Error Occurred, Please Check The Log (option 26)"
Press any key to continue . . .
java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)
A subdirectory or file modified-system-apk-files-here already exists.
Exception in thread "main" java.lang.UnsupportedOperationException: Not yet implemented
at brut.androlib.java.AndrolibJava.build(AndrolibJava.java:32)
at brut.androlib.Androlib.buildSourcesJava(Androlib.java:390)
at brut.androlib.Androlib.buildSources(Androlib.java:299)
at brut.androlib.Androlib.build(Androlib.java:282)
at brut.androlib.Androlib.build(Androlib.java:256)
at brut.apktool.Main.cmdBuild(Main.java:225)
at brut.apktool.Main.main(Main.java:84)
EDIT EDIT: Apparently I need the smali code instead. I'm going to try to convert java to smali and hopes this works. Fingers crossed!
APKTools is having an issue decompiling the resources in the first place,
Code:
C:\Program Files (x86)\Minimal ADB and Fastboot\modified settings>java -jar apktool.jar d Settings.apk
I: Using Apktool 2.0.2 on Settings.apk
I: Loading resource table...
Exception in thread "main" brut.androlib.AndrolibException: Multiple resources: spec=0x7f100000 bool/config_allow_edit_carrier_enabled, config=[DEFAULT]
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:63)
at brut.androlib.res.data.ResConfig.addResource(ResConfig.java:56)
at brut.androlib.res.decoder.ARSCDecoder.readEntry(ARSCDecoder.java:223)
at brut.androlib.res.decoder.ARSCDecoder.readConfig(ARSCDecoder.java:191)
at brut.androlib.res.decoder.ARSCDecoder.readType(ARSCDecoder.java:159)
at brut.androlib.res.decoder.ARSCDecoder.readPackage(ARSCDecoder.java:116)
at brut.androlib.res.decoder.ARSCDecoder.readTable(ARSCDecoder.java:78)
at brut.androlib.res.decoder.ARSCDecoder.decode(ARSCDecoder.java:47)
at brut.androlib.res.AndrolibResources.getResPackagesFromApk(AndrolibResources.java:544)
at brut.androlib.res.AndrolibResources.loadMainPkg(AndrolibResources.java:63)
at brut.androlib.res.AndrolibResources.getResTable(AndrolibResources.java:55)
at brut.androlib.Androlib.getResTable(Androlib.java:65)
at brut.androlib.ApkDecoder.setTargetSdkVersion(ApkDecoder.java:197)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:96)
at brut.apktool.Main.cmdDecode(Main.java:165)
at brut.apktool.Main.main(Main.java:81)
which leaves me with a resources.arsc presumably containing many files I need. I've downloaded APKtoJava_RC2, and managed to decompile it into java code using that (and I'm not sure if the classes.dex matters), and modify the APK to where I can enable the OEM unlock feature, but I need to recompile it. I'm trying to recompile the thing, but I'm running into issues (I've tried putting the modified java in src and deleting the resources.arsc when compiling) when installing.
EDIT EDIT EDIT: I've just been trying to edit the SMALI code to let me access the OEM unlock, I guess it's going to be trial and error for me. :v
So, here's what I need to do, in all essentiality:
1. Decompile Settings.APK to the point where I can modify it.
2. Recompile Settings.APK with the same signature.
I'm not sure if this is possible (editing the java while keeping the same signature), but root is NOT an option.
If anyone is willing to give me some insight, I'd really appreciate it.
Ok, so I know how to modidy the .smali, everything would work fine, if not for this final step.
I'm getting [INSTALL_PARSE_FAILED_UNEXPECTED_EXCEPTION] when I extract the .smali files from the classes.dex, and then recompile the .smali files into my own classes.dex-- EVEN IF I DON'T MODIFY THE .SMALI files. There is either an issue with extraction or compilation (maybe both)-- and I've tried several programs, and several methods.
EDIT: http://leonjza.github.io/blog/2015/...re-into-android-reversing-and-smali-patching/
Shows me that it has something to do with the signature. I'll see what I can do.
EDIT EDIT: Further research shows http://www.herongyang.com/Android/Project-META-INF-Files-Digest-Signature-and-Certificate.html that I MIGHT have to somehow get the certificate to work with the modified file properly. God help me now. I assume I'm not the first person to run into the certificate roadblock. Must find a way.
For all the heavens I can't seem to find a way to edit the .dex file in a way that leaves the certificate intact-- I suppose this is why the system was developed in the first place. Back to square one again, I suppose. (Or to giving up and buying a XTC 2 Clip)
I'm having trouble modifying an app and installing it again
Here are the steps I've taken to modify the app "AppToModify"
Copy the apk file from my phone in data/app location to my laptop
Use apktool to unpack the app
Code:
java -jar apktool.jar d AppToModify.apk
Go in the AppToModify folder and make a change (there's a Strings.xml file and I simply changed a text just to see if it works)
Pack the app with apktool
Code:
java -jar apktool.jar b apptomodify -o ~/Downloads/SignApk/app_to_modify_new_unsigned.apk
Either sign the app with signapk
Code:
java -jar signapk.jar certificate.pem key.pk8 /app_to_modify_new_unsigned.apk
or with uber-apk-signer
Code:
java -jar uber-apk-signer-1.1.0.jar -a apktool_workstation/app_to_modify_new_unsigned.apk
Move the app back to my phone and install
Error: App not installed
Am I missing something?
Tools and Specs
OS: Mac Sierra
Apktool v2.4.1
uber-apk-signer-1.1.0.jar
SignApk
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Click to expand...
Click to collapse
sorry had it in the wrong section, I hope this section can help me
EDIT: This was a apktool problem (multi-package resources), when decoding framework-res.apk from lineageOS 19.1(android 12).
When I use apktool 2.7 to decompile framework-res.apk I get the following.
apktool d framework-res.apk
gives a res/values folder but with 3 files with with hardly any data.
apktool d -r -s framework-res.apk
gives lost of files and folders but no res/values folder
Does res/values/arrays.xml exist in Android 12? Is it possible to decompile and view the arrays.xml using apktool?