Edit xml file from existing apk / recompiling apk - Android Q&A, Help & Troubleshooting

Hey
I am currently struggeling at editing a xml file in an .apk that i got.
I've used this Jadx decompiler (wwwDOTjavadecompilersDOTcom) to decompile the apk, which gave me the following files and folders:
fs5.directuploadDOTnet/images/160129/ypnqz7xuDOTpng
All the files are human readable.
But how do I recompile it? Can I load it into the Android Studio?
fs5DOTdirectupload.net/images/160129/ho4vszubDOTpng
As you can see importing into android studio did not really work. The app couldn't be run.

Search for apktool here. It is what is used for decompiling and recompiling apks.

Related

[Q]How make src.zip to .jar?

Hello, i'm new with editing .jar files, and i have a question:
first of all my steps:
classes.dex
dex2jar Program
get .jar file
used Java Decompiler for src-jar.jar file
now i'm trying to figure out how to compile all the steps back into classes.dex file.
for more understanding of my question:
Decompiled "Camera.apk" and disassembled the "classes.dex" file...

[Q] APK modding Deskclock - Please Help

So i have this Deskclock.apk and i want to add this.
No Problem with the ".xml" Files. I can edit them easily after i decompile the apk with the "apkTool". But where will i find the ".java" Files? After decompiling the apk i only see ".smali".
So i found out that the ".java" files are in "classes.dex" from the apk.
I use "dex2jar" to get a ".jar" File.
Then i use "jd-gui" to get ".java" Files.
So i can edit it and put the needed Strings in the .java files.
But how to put them back to a "classes.dex" File which i can put back to the apk??
I hope i get a bit help here.
You can use APKTool. It will automaticly extract all the classes (.dex), resources (.asrc), then it will convert binary XML to human-readable XML, and it will also dissassemble the classes for you.
Just tell APKTool to decode the APK into a directory, then modify what you want, and finally encode it back to an APK. That's all.
Important: APKTool dissassembles. It doesn't decompile. The generated code won't be Java source. But you should be able to read it, and even edit it if you're familiar with jasmin. If you want Java source, please go over the Manual way.
Sent from my VS910 4G using XDA
Thx...I know how to use APKTool but i need to put the ".java" Files back into the "classes.dex". Thats my Problem.
There's info on the process here: http://stackoverflow.com/questions/10261147/converting-java-back-to-classes-dex
Essentially it looks like you need to compile the .java to .class files with javac and then create classes.dex with dx. Hope this link is helpful.

Modifying APKs on Lollipop

Hello everyone,
I hope I'm posting this to the right forum.
Up until Android 4.4 KitKat we were able to use apktool for decompiling an apk, making modifications and then recompiling it.
In case we were dealing with an ODEXed ROM, we could also use backsmali and various other tools to deodex before using apktool.
Now, in Lollipop, which uses ART, we get an APK file, but also a .odex file in a '/arm' subfolder.
From what I've read so far, that's not really an odex file, but rather an Android runtime .OAT file.
My question is - how does this affect our abilities to edit APKs?
Is it possible to "deodex" the OAT file to get an all-inclusive APK to use with apktool? If so, how?
After we rebuild the APK, can we just run it 'deodexed' or do we need to recreate an OAT file?
Any insight would be appreciated
purpleman2k said:
Hello everyone,
I hope I'm posting this to the right forum.
Up until Android 4.4 KitKat we were able to use apktool for decompiling an apk, making modifications and then recompiling it.
In case we were dealing with an ODEXed ROM, we could also use backsmali and various other tools to deodex before using apktool.
Now, in Lollipop, which uses ART, we get an APK file, but also a .odex file in a '/arm' subfolder.
From what I've read so far, that's not really an odex file, but rather an Android runtime .OAT file.
My question is - how does this affect our abilities to edit APKs?
Is it possible to "deodex" the OAT file to get an all-inclusive APK to use with apktool? If so, how?
After we rebuild the APK, can we just run it 'deodexed' or do we need to recreate an OAT file?
Any insight would be appreciated
Click to expand...
Click to collapse
Files needed:
1. bootoat2dex.jar
2. Cygwin
3. APKTOOL
4. Java will need to be installed also
Install Cygwin and run it once so your userfolder is created, will be in c:/cygwin/home/<User Name>
Copy bootoat2dex.jar into this folder
Go to priv/app/SystemUI/arm/ and use 7zip to extract SystemUI.odex from the SystemUI.odex.xz file
Copy SystemUI.odex to your cygwin folder c:/cygwin/home/<User Name>/
Open cygwin and run the following command:
java -jar bootoat2dex.jar SystemUI.odex
This will output 2 folders dex and odex, if you look in the odex folder you should see SystemUI.odex.
Rename this file to classes.dex and drop it into the SystemUI.apk file
Follow the same instructions for the twframework-res.odex file also.
now copy the files SystemUI.apk, framework-res.apk and twframework-res.apk into you apktool folder and install framework ex. apktool if framework-res.apk, apktool if SystemUI.apk, apktool if twframework-res.apk
After the framework install you should be able to decompile SystemUI.apk, you should be able to do this with all the apk files.
C13v3r0n3 said:
Files needed:
1. bootoat2dex.jar
2. Cygwin
3. APKTOOL
4. Java will need to be installed also
Install Cygwin and run it once so your userfolder is created, will be in c:/cygwin/home/<User Name>
Copy bootoat2dex.jar into this folder
Go to priv/app/SystemUI/arm/ and use 7zip to extract SystemUI.odex from the SystemUI.odex.xz file
Copy SystemUI.odex to your cygwin folder c:/cygwin/home/<User Name>/
Open cygwin and run the following command:
java -jar bootoat2dex.jar SystemUI.odex
This will output 2 folders dex and odex, if you look in the odex folder you should see SystemUI.odex.
Rename this file to classes.dex and drop it into the SystemUI.apk file
Follow the same instructions for the twframework-res.odex file also.
now copy the files SystemUI.apk, framework-res.apk and twframework-res.apk into you apktool folder and install framework ex. apktool if framework-res.apk, apktool if SystemUI.apk, apktool if twframework-res.apk
After the framework install you should be able to decompile SystemUI.apk, you should be able to do this with all the apk files.
Click to expand...
Click to collapse
Great info! Thanks! I have used oat2dex.py to extract the OAT file, baksmali'd, modified smali code, recompiled it but that's where I'm stuck. How do I get it back into the original OAT format for inclusion in an Odexed rom? Any help would be greatly appreciated.
P.S. I'm working with SystemUI.odex.
jermaine151 said:
Great info! Thanks! I have used oat2dex.py to extract the OAT file, baksmali'd, modified smali code, recompiled it but that's where I'm stuck. How do I get it back into the original OAT format for inclusion in an Odexed rom? Any help would be greatly appreciated.
P.S. I'm working with SystemUI.odex.
Click to expand...
Click to collapse
I haven't been able to find anything that will take the files the other direction.

Re-compiling AndroidManifest.xml only

Is there a way to compile just AndroidManifest.xml?
I'm de-compiling an apk using --force-manifest flag in apktool and can't seem to be able to re-compile the manifest, so i'm unable to use the app. (I signed the apk after building)
Guyishay said:
Is there a way to compile just AndroidManifest.xml?
I'm de-compiling an apk using --force-manifest flag in apktool and can't seem to be able to re-compile the manifest, so i'm unable to use the app. (I signed the apk after building)
Click to expand...
Click to collapse
Hmm... I don't think that's possible, but you may get something similar, according to APKTOOL Documentation using these options:
Code:
--no-assets
Prevents decoding/copying of unknown asset files.
Code:
--no-res
This will prevent the decompile of resources. This keeps the resources.arsc intact without any decode. If only editing Java (smali) then this is the recommended action for faster decompile & rebuild
Code:
--no-src
This will prevent the disassembly of the dex file(s). This keeps the apk dex file(s) and simply moves it during build. If you are only editing the resources. This is the recommended action for faster disassemble & assemble

Where can I find files with button names in an .apk file?

Hi, let me explain.
I'm translating a gamebook app for Android. So far I've managed to decompile the .apk file, find and edit the .xml files with storyline, but I cannot find the files that contain the data about the app menu buttons (options, settings, save/load etc.). The decompiled game folder contains following folders:
- assets (.xml files with story)
- original
- smali
- smali_classes2
- unknown
- AndroidManifest XML document and apktool YML file
I tried opening random smali files with EditPlus, but couldn't find anything. Any tips how can I edit those buttons? Where to find the code? I just want to change the text to another language.

Categories

Resources