[TOOL][WINDOWS] Android Multitool - Android Software Development

Android Multitool
Hello,
I´m glad to present my Android Multitool wich makes it easier to decompile/recompile applications + jar framework files. You can also sign your apk by easily clicking a button.
Requirements:
Winows OS XP / 7 / 8 / 8.1 / 10
Installed Java on Windows
Installed Microsoft Powerpacks
Installed .NET framework
- Easy handling: Select your apk and push the "decompile" button!
- This tool makes modding much faster and easier, no cmd handling any more.
- You can read the log which is integrated in the tool to find your mistake in the error.
- ADB inside: Push files into your file system with a few clicks
It looks like this so far:
{
"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"
}
How to use this tool?
Follow this small how to!
Here you go..
Well, first extract the AndroidMultitool folder to C:\. Otherwise it probably won´t work
-copy your framework-res.apk in the Framework-Files folder and other files you want to mod in the "Files" folder (this folder is for all your files you want to mod, don't pick files from any other location)
-Next you have to start AndroidMultitool.exe
-select your framework-res.apk and push the "install" button (check log for errors)
Decompiling and recompiling apk files:
-select the apk you want to mod/decompile and push the "decompile" button (check log for errors)
Note: You can check the "use baksmali" checkbox, then e.g. the useless .line text will be removed
-your decompiled apk will be located in C:\AndroidMultitool\Decompiled_apk"apkname" as a folder
-if you want to compile your apk again, select your decompiled folder, check the "apk" radio button and compile it again (check log for errors)
-your recompiled apk will be located in C:\AndroidMultitool\Compiled_apk"apkname"
Decompiling and recompiling jar files:
-select in the combobox ".jar" (check the "use baksmali" checkbox for deleting the useless .line comments)
-select the ".jar" file you want to mod
-push the "decompile" button
-your decompiled jar file will be locaten in C:\AndroidMultitool\Decompiled_jar"jarname"
-for recompiling you have to check the "jar" radiobutton and select the folder within your decompiled ".jar" file
-push the compile button
-your compiled jar file will be located in C:\AndroidMultitool\Compiled_jar"jarname"\classes.dex
-delete the "classes.dex" file in your ".jar" file
-copy the new "classes.dex" file you compiled in the ".jar" file
Signing apk files:
-select the ".apk" you want to sign
-push the "sign" button
-the signed apk file is located in C:\AndroidMultitool\Signed_apk"apkname_signed"
Using tags:
You want to decompile many files from different devices or different android versions / frameworks? Tagging makes it possible!
- before installing your framework type in any tag (like "hero")
- then install your framework and work normally
Android Debug Bridge
You want to push files with adb to your device? Follow these instructions:
Please klick on the "advanced" register in the tool
-push "check" to control if your device is ready
-if the device is not ready please follow the instructions, which are listed in the tool (device offline, no device...)
-if the device is ready, choose a file you want to push
-choose a path on the device, where the file should be placed later
-push the "push" Button
-alternately: press "Reboot device" to reboot your device and to let changes take effect
If there are any questions or bugs, please post them in the thread.
Follow me on Google+ : Daniel Huber
[DOWNLOAD] see next post #2
Enjoy easier apk handling!
Having issues with the program?
Try the batch version developed by @bovirus (it's also in the AndroidMultitool folder)
Questions and answers:
Q: The programm does not start, it crashes.
A: Please install Powerpacks, this one: http://go.microsoft.com/fwlink/?LinkID=145727&clcid=0x804
Q: What do you mean exactly with "!!!NOTE!!! After compiling you have to copy the AndroidManifest.xml and the META-INF folder from your old apk to your newly compiled one!! Otherwise you´ll get bootloop! " .. I don't understand.
A: You have to open your old apk (this one you selected for decompiling in the folder /files) and copy from that apk the AndroidManifest.xml and the META-INF folder to the apk you just decompiled and recompiled.
Q: I followed all steps in the startpost but I'm still getting this error: "apktool is not recognized as internal or external command"
What can I do?
A: Please refer to this post by @LasVegasRomeo: http://forum.xda-developers.com/showpost.php?p=51017662&postcount=681
Credits:
Developers (brut.all, iBotPeaches) of the base Apktool
mike_galaxy_s for his help on testing
@bovirus for batch development
------------------------------------------------------
Changelog:
v3.5.9:
updated build tools and platform-tools (aapt, adb and needed dll's)
updated 7za, apktool, smali and baksmali to latest version
added bovirus's batch version to the main directory (users can choose between gui and batch now)
added a folder (Framework-Files) for the framework-res.apk (only use this folder for the framework files from now on)
added a Help folder with all commands
v3.5.8:
updated build tools and platform-tools (aapt, adb and needed dll's)
updated apktool, smali and baksmali to latest version
v3.5.7:
updated build tools and platform-tools (aapt, adb and needed dll's)
updated apktool, smali and baksmali to latest version
v3.5.6:
fix progressbar not disappearing after decompiling
fix loop after/while compiling
save compiling path and jump into it when he starts folder browsing
update user interface
v3.5.5:
fix infinite loop on compiling when errors appeared
folderbrowserdialog (compiling): jump into /decompiled_apk default
update build tools and platform-tools (aapt, adb and needed dll's)
v3.5.4:
add option to copy AndroidManifest.xml automatically into the apk after compiling
layout cleanup
force overwrite already compiled or decompiled files when new compiling/decompiling thread started
update to apktool rc3 (mainly lollipop support)
v3.5.3:
copy AndroidManifest.xml and META-INF folder automatically into the apk after compiling
added some links
code cleanup
v3.5.2:
add more detailed log
fix decompiling/compiling/signing/installing framework multiple times sometimes
add batch decompiling (preview)
fix donation image not fitting center
add txt files with descriptions for all tools inside (thanks to @bovirus)
v3.5.1:
update all files
v3.5:
code rework
fix UI freezing on long tasks
add progress bar
many other small fixes
v3.4:
access files from all locations of the pc (you're not limeted to the /Files folder)
add version number to the tool
v3.3:
add tag support (tagging allows multiple framework support)
rework interface
small additions and fixes
support for Win7 / 8 / 8.1 (no extra versions)
v3.2.1:
add apktool b9
v3.2:
add different apktool, aapt and batch files
should solve some problems on de - and recompiling
v3.1:
Fixes for adb push
button to reboot device
many other fixes and code rework
v3.0:
SlimBean apktool ((de)compiling also with inverted folders from trds)
ADB (AndroidDebugBridge for pushing files to your device)
Some Links in the tool for support and donation
v2.2 Beta1:
apktool 2.0.0
Details:
Details
v1.5.x -> v2.0.0
Java JRE 1.7 is required!
Update apktool to v2.0.0
aapt is now included inside the apktool binary. Its not required to maintain your own aapt install under $PATH. (However, features like -a / --aapt are still used and can override the internal aapt).
Remove framework $HOME/apktool/framework/1.apk or manually update via (FrameworkFiles)
Eagle eye users will notice resources are now decoded before sources now. This is because we need to know the API version via the manifest for decoding the sources.
Parameter Changes
Smali/baksmali 2.0 are included. This is a big change from 1.4.2. Please read the smali updates here for more information.
-o / --output is now used for the output of apk/directory.
-t / --tag is required for tagging framework files
-advance / --advanced will launch advance parameters and information on the usage output.
-m / --match-original is a new feature for apk analysis. This retains the apk is nearly original format, but will make rebuild more than likely not work due to ignoring the changes that newer aapt requires.
After [d]ecode, there will be new folders (original / unknown) in the decoded apk folder.
original/ = META-INF folder / AndroidManifest.xml, which are needed to retain the signature of APKs to prevent resigning. Used with -c / --copy-original on uild.
unknown/ = Files / folders that are not part of the standard AOSP build procedure. These files will be injected back into the rebuilt APK.
apktool.yml collects more information than before
SdkInfo = Used to re-populate the sdk information in AndroidManifest.xml since aapt requires it to be passed at runtime.
packageInfo = Used to help support Android 4.2 due to renamed manifest packages. Automatically detects difference between manifest and resources and performs automatic --rename-manifest-package on uild.
versionInfo = Used to re-populate the version information in the AndroidManifest.xml since aapt requires it to be passed at runtime.
compressionType = Used to determine the compression that resources.arsc had on the original apk to duplicate on uild.
unknownFiles = Used to record the name/location/compression type of non-standard files in Apk.
v2.1:
fixed freezes
bigger UI for better overview
option to save log to a text file
other small fixes
v2.0:
complete code rework
folder structure for a better overview
decompiled, recompiled, signed files will be located in their own folder
no more messy file handling
added radio buttons for choosing jar or apk
some graphical changes
added info button in the "installing framework" section
V1.2:
Added ability to decompile and recompile ".jar" files
Added baksmali
FolderBrowserDialog: If you push the "browse" button you are in the right directory now and needn't to scroll and search the "AndroidApktool" folder
other small fixes
V1.1:
Added ability to sign .apk
Changed comboboxes to browse buttons
bigger log - screen
Initial Release

- Latest mod version
Latest version is: 3.5.9 (23.10.2018) updated by bovirus
This version is based on original v. 3.5.9 by Flextrick plus with these updates
- apktool (by iBotPeaches) v. 2.3.4 stable
- apktool commands list
- baksmali/smali (by JesusFreke) v. 2.2.5 stable
- baksmali/smali command list
- Android Build Tools (by Google) v. 28.0.3 stable
- Android Build Tools commands list
- Android Platform Tools (by Google) v. 28.0.1 stable
- Android Platform Tools commands list
- 7zip (by Igor Pavlov) v. 18.05
- DOS batch updated (now support file names with spaces)
With the DOS batch (file AMT.BAT) you can
- install framework file
- select application
- decompile application
- compile application
- sign application
Android Multitool v. 3.5.9 (updated) - Download
- Android Multitool previous version
Library of previous version (Google Drive)
Note: Please take care that v. 3.5.9 (stock) included in the Google Drive repository DON'T include all updates reported before.
- Use always updated framework-res.apk
If you get error during decompilation/compilation of the apk, please check if you are using and updated version of framework.res.apk.
Please try to search, find and download an updated version of framework.-res.apk
Note: I suggest to rename the framework downloaded file name (without spaces) adding some info about it (like brand-model of device and Android version), like
framework-Samsung-S8-Android-7.1.2.apk
put the file in it in Framework-Files sub-folder of Android Multitool and install it in Android Multitool.
Then try again to decompile/recompile the application.
- External references
- apktool by iBotpeaches
apktool by iBotPeaches - XDA thread
apktool by iBotPeaches - XDA thread
- baksmali/smaly by JesusFreke
baksmali/smaly by JesusFreke - Download (bitbucket.org)
baksmali/smaly - XDA discussion thread
baksmali/smaly by JesusFreke - Source (Github)
- 7zip by Igor Pavlov
7zip by Igor Pavlov - Tool to decompress/compress files
- Android Platform Tools by Google
Android Platform Tools by Google - latest Windows version
..

Very nice tool!
One feature request, could you have a checkbox for say the -b command so that we can get rid of the useless .linexx and .prologue lines? That would make this tool perfect
Another feature is adding the twframework-res.apk as a framework file? Thats essential for modding samsung system apk's. I usually have to install both twframework-res.apk and framework-res.apk before decompiling. Maybe adding 2 slots for the framework in the tool?
Thanks again!!

Good work bro....
Very nice..
Sent from my GT-S6312 using xda app-developers app

clark44 said:
Very nice tool!
One feature request, could you have a checkbox for say the -b command so that we can get rid of the useless .linexx and .parameterxx lines? That would make this tool perfect
Another feature is adding the twframework-res.apk as a framework file? Thats essential for modding samsung system apk's. I usually have to install both twframework-res.apk and framework-res.apk before decompiling. Maybe adding 2 slots for the framework in the tool?
Thanks again!!
Click to expand...
Click to collapse
Sure, adding a second slot will be no problem!
But I don't know what you mean with this checkbox, could you explain me exactly what you mean?
~ via Nexus

Flextrick said:
Sure, adding a second slot will be no problem!
But I don't know what you mean with this checkbox, could you explain me exactly what you mean?
~ via Nexus
Click to expand...
Click to collapse
When I decompile using baksmali this is the command I run...
Code:
java -jar baksmali.jar -b -o c:/smali c:/smali/classes.dex
The -b command prompts baksmali to remove all .line type code from the smali.
Here is an example .smali file before and after the -b command...
BEFORE: http://pastebin.com/gYKQ90cW
AFTER: http://pastebin.com/17i8k1X2
This method of decompiling smali makes it much much simpler to compare to other code.
Thanks!! :highfive:

Ah, I'm understanding. Yes, I think that's possible as well!
~ via Nexus

Flextrick said:
Ah, I'm understanding. Yes, I think that's possible as well!
~ via Nexus
Click to expand...
Click to collapse
Cool. Cant wait
One more thing, will you be adding the ability to decompile more then one apk/jar?

At once? Would work, I think.
Two possibilities:
The first apk decompiles, and then the second one
Or: Both are decompiling at the same time, but in two different processes.
~ via Nexus

Flextrick said:
At once? Would work, I think.
Two possibilities:
The first apk decompiles, and then the second one
Or: Both are decompiling at the same time, but in two different processes.
~ via Nexus
Click to expand...
Click to collapse
One then the second and so on would save the most memory and prevent crashes on weaker machines

androidapktool.exe does not open on my win 7 32 bin in admin mode.... i have java 7u25 installed.
need java 6?

Flextrick said:
ANDROID APKTOOL
exe crashed on my PC
Win 7 x64, Java 7 w/ update 21 (64-bit) installed.
(AMD FX-8120, 16Gb ram)
Just try with java 6
Click to expand...
Click to collapse

fvadym said:
Flextrick said:
ANDROID APKTOOL
exe crashed on my PC
Win 7 x64, Java 7 w/ update 21 (64-bit) installed.
(AMD FX-8120, 16Gb ram)
Just try with java 6
Click to expand...
Click to collapse
AndroidApktool.exe won't start, neither with 6u45 nor with 7u25 (latest versions)
whats wrong... ?
i have copied framework-res.apk into C:\AndroidApktool from my samsung galaxy s3 i9300, FW XXEMD3 / 4.1.2 jelly bean.
i tried to run it as normal and as an adminstrator... nothing happened at all.
Click to expand...
Click to collapse

yeah not running on windows 8 either

is there something we have to install, too?

Hello, there can be a lot of things.
Maybe you are missing the .NET framework, or some dll´s.
I also uploaded a new .exe just for testing. New is the progressbar.
Download: http://www.mediafire.com/?6y7qi0x8h9q6pt7
Cheers

Flextrick said:
Hello, there can be a lot of things.
Maybe you are missing the .NET framework, or some dll´s.
I also uploaded a new .exe just for testing. New is the progressbar.
Download: http://www.mediafire.com/?6y7qi0x8h9q6pt7
Cheers
Click to expand...
Click to collapse
Test new .exe......
best regards "D"

Could anybody test trying to install .NET Framework?
Hopefully I get a solution for this problem, otherwise I'll make an Installer.
~ via Nexus

@Flextrick
I have NET Framework 4.5, Java 7 Update 25 and Java SE Development Kit 7 Update 25.
Edit:
You've got a Private Message
"D"

Ok. For starting the Tool is no Java necessary.
I think the dll's are missing, hopefully I get it working as far as possible.
~ via Nexus

Related

[FM TRANSMITTER] (dev needed)

this is an older tutorial i found for the evo way back. it needs to be updated..
this could possibly work on other android htc phones to that have the fm transmit capability....
the evos Broadcom chip has a built in fm receiver and also a transmitter.
according to some threads and diagrams ive seen the transmitter does have a power source, it just doesnt have and software code to actually work.
like hdmi the hardware was there but there was no code set up, therefore we didnt have full hdmi out. it had to be built from scratch.
the hardware for the fm transmitter is there we just need some one to build the code for it.
some one please take this on!!
This tutorial was originally posted in > android development and hacking > android software development.
i am reposting it here in the evo forums for guidelines
its a nice tutorial but its old. i think it was for android 2.0 ive followed the tutorial but i couldnt get it working, and i by no means have the experience to switch things up and get it working.
[TUTORIAL] Reverse engineering HTC FM Radio for noobs (on EVO 4G)
Okay, I'm writing this because I want to help any other newbies trying to learn how to reverse engineer. The technical details involved in this are extremely daunting, so the purpose of this tutorial is to first explain in layman terms exactly what you're trying to accomplish and what to expect. Then we'll go over the details. That way you're not completely blind going into this. I'm fairly new to the scene, so I'm not as knowledgeable as everyone else. If you see any errors in my post, let me know so I can change. I'm going to assume you know a little bit of Java, can find your way around a computer, and know nothing about Android. The techniques used should work with other Android phones. For this tutorial I'm using Windows 7, Cygwin, and my stock (not rooted) EVO 4G mobile phone.
The FM tuner for the Evo is run by a Broadcom chip: BCM4329. This chip is pretty amazing in that it does wireless, bluetooth, and it has an FM receiver/transmitter. We're interested in the FM receiver / transmitter.
Now, all android phones are based on a Linux kernel. Basically they're Linux running computers. The Android operating system is then installed onto the linux system. Every app is then run off of Android.
Android is based on Java but it is not a Java system. It uses a virtual machine called Dalvik. Google did this to get around licensing issues with Sun Microsystems. So they pretty much invented their own machine language (called byte code) for the Java language. This makes things complicated for the reverse engineer because from what I've read, once Java is converted into this machine language or byte code, it can't be converted back.
So let's rehash.
If you were programming strictly in Java, you would see these extensions:
Java source code = .java
Compiled Java source code = Java byte code = .class
Compressed file to package your program = .jar (Java Archive)
But since you're programming in Android and Dalvik, you will see these:
Java source code = .java
Compiled Java source code = Dalvik byte code = .dex
Compressed file to package your program = .apk
(I haven't mentioned this, but HTC further Optimizes their .dex code)
Optimized Dalvik byte code = .odex
I'm writing all of these down because it's very easy to get confused with all of the extensions. (for me at least!). remember how I said once you go dex, you can't go back to java? That's where JesusFreke comes in. He's a senior member of XDA, and he created "baksmali" and "smali", two programs that can convert the Dalvik code back into a human readable format. These files have extensions of .smali
Decompiled Dalvik byte code = .smali
But what can you do with .smali files? That's where this other senior member, brut.all comes in: He developed apktool. apktool takes JesusFreke's work to the next level. This program in conjunction with NetBeans, actually lets you trace through any program using the .smali code taken from JesusFreke's programs!
apktool does this by converting those .smali files into "fake" .java files that can be used by the NetBeans (program that compiles and makes java programs) IDE. I say "fake" because apktool embeds the .smali code into java files as comments. However, once you attach a debugger to NetBeans, you'll see that the debugger will follow line by line every execution statement found in the smali code!
So...... you can take the program you want, plug it into Net Beans using a debugger (using the default ddms command provided by Android SDK), and you can trace everything you do in the program. I have it connected to my phone, so whenever I push a button while running my HTC FMRadio app or unplug my headphones,I see the corresponding response to the HTCFMRadio code I have loaded in NetBeans. I can now see in real-time how the program operates from my own interactions... JAM.
Technical Aspects: How to get from ground zero to tracing HTCFMRadio?
1.) Download Android SDK - Go to google development site and follow instructions: Make sure to download the latest Java JDK. Once that is installed, download NetBeans 6.8. Unfortunately, smali debugging does not work with the lastest versions of NetBeans.
Download the "Java SE" version for minimal space
http://netbeans.org/downloads/6.8/index.html
You can follow the rest of Google walkthrough and download Eclipse and ADT plugin, but it's not pertinent to this. You're going to be using adb and ddms from the android SDK extensively, so make sure the path for </android SDK/tools> is included in the PATH variable in your ENVIRONMENT SETTINGS. To get here, right click My computer, click properties, Advanced Settings, ENVIRONMENT SETTINGS.
2.) Search for 7z and download it. It is an awesome and free compression tool that will be extremely useful. It can be used to "unzip" .jar, .apk, and other compressed formats.
3.) Get the Radio app. You can do this by going to "shipped-roms" website, downloading the latest Supersonic image, and following the directions in the unlockr tutorial for HTC kitchens at the unlockr website... (once you have extracted the files from the image, you can look in the system/app and system/framework directories to get the files listed below) or:
you can pull the following files from your phone:
Using the command prompt type (and with phone plugged in, and with USB debugging enabled on phone):
adb pull /system/app/HtcFMRadio.odex
adb pull /system/app/HtcFMRadio.apk
adb pull /system/framework ./framework
This will put HtcFMRadio.odex and HtcFMRadio.apk in the current directory and create a framework directory with more files. A couple of the files in the framework are needed for the HtcFMRadio app, but for simplicity, we're just going to pull the whole directory.
Now that we have the files, we have to make a few changes to make the app installable and to be viewable by the debugger. To do this we have to decompile the .odex format into a human readable format we can edit. That brings us to:
3.) Download baksmali and smali from Project Hosting on Google Code (google search smali).
Usually an Android application is made up of one file, an apk file. Inside the apk file is an AndroidManifest.xml file, a classes.dex file (compiled Java code for the program), and other folders. The other folders contain either graphics or other .xml files that tell the program how it should look to the user. We don't have to worry about those for now. This is important because APKTOOL only opens programs set up this way. But wait up? We didn't download one .apk file, we downloaded an .apk file and an .odex file! What gives? Well, if you right click the apk file and open it (using 7z), you'll see that it's missing the classes.dex file. The dex file for the app is actually the HtcFMRadio.odex file we downloaded. So, to make this system app more like a nominal app, we have to find a way to convert the HtcFMRadio.odex to a classes.dex file. That's easy with baksmali and smali!
Once you download goto command prompt and type:
java -jar baksmali-<version>.jar -d framework -x HtcFMRadio.odex
(Remember to match baksmali-<version>.jar with the filename of baksmali you downloaded)
If done correctly, you should see a newly created \out directory
This creates an out\com\htc\fm directory with many .smali files.
Now let's reverse the process and put it back as a dex file. Type at command prompt:
java -jar smali-<version>.jar out -o classes.dex
If done correctly you'll see a newly created classes.dex.
now, right click on HtcFMRadio.apk (select 7z and open). Drag classes.dex into the file. Say yes to the prompt. Now you have a normal apk file APKTOOL can read!
4.) Download APKTOOL from Project Hosting on Google Code and the helper apps for your OS. (If you're extracting files for windows OS you should have apktool.bat and aapt.exe). Extract (again using 7z, don't you love this program?) apktool.jar (keep it as a jar file, don't extract the stuff inside of it), apktool.bat, and aapt.exe to the directory you're working on. To make things neat, you can also delete HtcFMRadio.odex (you don't need it anymore) and classes.dex (make sure you put it in the HtcFMRadio.apk file first!)
If this is the first time you're using apktool, then you have to install the htc framework so apktool can baksmali the Radio app. You only have to do this once:
apktool if ./framework/com.htc.resources.apk
Alright, at the command prompt:
apktool d -d HtcFMRadio.apk
This extracts the contents of HtcFMRadio.apk and places them in the HtcFMRadio directory. However, there are two major differences between this content and the content created in step 3. If you go into the smali directory you'll see that instead of .smali files, you'll see .java files. And if you go back and edit the AndroidManifest.xml file, you will also see that it's in text! Android applications convert their xml files to binary format. Now that APKTOOL has converted everything to an IDE friendly format, we can use NetBeans to edit everything. The first thing we're going to do is edit AndroidManifest.xml (using notepad) and add the following:
android:debuggable="true" to the Application tag.
IT should now look like this:
<application android:theme="@android:style/Theme.Black.NoTitleBar" android:label="@string/fm_app_name" android:icon="@drawable/fm_radio" android:taskAffinity="android.task.fmradio" android:description="@string/htc_corp" android:allowTaskReparenting="true" android:debuggable="true">
This permission lets the debugger watch the program while it's running on the phone.
We are going to run into two problems if we try to install this program. One is that Android doesn't let you install more than one copy of a system app. The second issue is that if we change the signature of our system app, then we'll have to change the signatures of our other system apps as well! Ahh.... So, to get around that, we're going to trick Android into thinking we have a completely new program. We're going to do that by renaming the com.htc.fm class to com.htc.modradio class. Next step:
5.) Cygwin (or Linux virtual machine)
The easiest way that I can think of to replace strings in multiple files is by using linux. You can most definitely do it in WIndows, but I dont know how. If you let me know how, I can put it in this tutorial.
(update: you can use Notepad++ to easily find/replace strings in multiple files for Windows. You still, however, want to download Cygwin if you're going to develop with Android-NDK.)
For now, just search for Cygwin (Cygwin is a program that lets you run Linux commands from a command prompt using your Windows directories), and install it. Make sure to have the Perl option selected. You'll need Perl to make the following commands work.
Once you get Cygwin up and running
cd <to your HtcFMRadio directory>
in my case it's
cd /cygdrive/c/Users/Jerry/Desktop/HtcFMRadio
now type the following commands in this order:
this command changes all occurances of htc/fm to htc/modradio in your xml and .java files.
find ./ -type f | xargs perl -pi -e 's/htc\/fm/htc\/modradio/g'
this command changes all occurances of htc.fm to htc.modradio
find ./ -type f | xargs perl -pi -e 's/htc.fm/htc.modradio/g'
If you don't follow this order, your source code will get messed up.
If using cygwin, a bunch of .bak files will be created. Using windows search, find all .bak files in your HtcFMRadio directory, then select them all and delete them (Make sure they are only files with .bak!)
Now just rename the fm directory to modradio. It is located in HtcFMRadio/smali/com/htc
Now go to your windows command prompt and type:
apktool b -d .\HtcFMRadio modradio.apk
Now sign and install modradio.apk on your phone.
adb install modradio.apk
If you have never signed before, then you need to use keytool and jarsigner. These two files are in your JDK directory, so make sure you include your JDK directory in the PATH variable of your ENVIRONMENT SETTINGS. (To get here, right click on My Computer, click Properties, Advanced Settings, Environment Variables. Once you make change, open up a new COMMAND prompt to see changes).
cd to the directory which has modradio.apk
now type:
keytool -genkeypair
Answer all questions, then use the same password for all password prompts.
Next type:
jarsigner -verbose modradio.apk mykey
Type in the password you created in the above step. Your apk should now be signed.
Next install:
adb install modradio.apk
Success!
6.) Testing the app on phone
Go to your phone and you'll now see a new FMRadio icon next to your first. Click on it and watch it open. It should now be able to play music. Keep it open.
7.) Using Netbeans
Go into HtcFMRadio and delete the build directory created by APKTOOL.
Now open up Net Beans and click on File, New Project, Select Java Project with Existing Sources, click on Next
Select HtcFMRadio directory for Project Folder, rename Project Name to whatever you want. Let's type in ModRadio. click on Next
Next to "Source Package Folders" click on "Add Folder" and select the smali directory.
Click Finish. For a quick tutorial by Brut.all, search APKTOOL in youtube and click on: Apktool Demo 2 - Smali improvements
Right click on Libraries. Click on "Add Jar / Folder". You want to add Android.Jar. Since I have Android 2.1 loaded I went to /platforms/android-7 located in my android SDK directory.
Your project is now ready for editting!
8.) Running the Debugger to trace through program.
Next go back to Windows command prompt and type ddms. This runs the Dalvik Debug Monitor. A window should open up. In the left hand side you should see com.htc.modradio. That's our app! To the right you're going to see 2 numbers, you're interested in the one to the right, 4 cells away from com.htc.modradio. This number is a port number, and you're going to use it to communicate with NetBeans. (In my case it is 8603)
Go back to NetBeans and click on Debug, Attach Debugger.
In the host field type: localhost
In the Port field: type in the second number you saw. (8603)
If everything is working you'll see a bug appear next to com.htc.modradio in the Dalvik Debug Monitor. Look at the bottom bar of NetBeans for feedback. If you get errors make sure the numbers match, or try port 8700 and make sure you select com.htc.modradio in the Dalvik Debug Monitor. Port 8700 is the default port used for whatever program you select in Dalvik Debug Monitor.
9.) Setting a breakpoint
I'm making this a seperate step because it is completely arbitrary. When creating a break point be sure to follow this rule:
You must select line with some instruction, you can't set breakpoint on lines starting with ".", ":" or "#".
Rather than looking for a spot to breakpoint, though, I'll tell you where to put one so you can quickly see how the debugger traces through the code. You aren't "REQUIRED" to do the next step, but if you want to trace you have to put a breakpoint somewhere.
In Net Beans click on the Project tab, click on Source Packages, com.htc.modradio, and then doubleclick on BroadcomFMTuner.java
We're going to insert a breakpoint. Scroll down to line 3226 and on your keyboard press: CTRL-SHIFT-F8, select line in dropdown box and hit ok. (To keep it simple, I usually look for "invoke" instructions to set breakpoints at)
Now go to your phone and click on the physical "back" button on your phone. This will clear the radio,(you should still be able to listen to music). Drag your status bar down. You should see a radio icon. Click on it again. The radio backgroudn will appear, but you wont' see any text or anything. Now go back to your netbeans application. You should now see debug options highlighted! Click on Step Over (F8) to step through!
{
"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"
}
i found a few things.
http://pdf.eccn.com/pdfs/Datasheets/Broadcom/BCM4329.pdf
http://www.broadcom.com/products/Bluetooth/Bluetooth-RF-Silicon-and-Software-Solutions/BCM4329
I didn't read all of this but I have to mention that byte code is not a type of machine code..
byte code is what is created when you compile a java file. The JVM or dalvik-VM in this case, then converts this byte code to machine code at run time.

[Guide For creating custom Rom's]N00B Proof ]

So you heard alot about creating a custom rom how about creating one with ease with this simple guide you will find it easy
So for whom is this guide?
1.Absolute Beginners.
2.People with little or no programming skills
3.people who really want to learn how to make custom rom's
4.people who want to learn android and don't know where to start
Click to expand...
Click to collapse
Tools Required : (Update them manually and report me dead links please)
Java JDK FROM HERE FOR INSTALLING CYWIGN
WARNING: Do not install Cygwin before the JDK!!
Click to expand...
Click to collapse
Cywign Direct Download- Linux Terminal For Windows
Android Kitchen (ROM Development Tool)- For Cooking custom ROM and many more things, Please update this Kitchen to latest version when available.
notepad++ - for editing files like build.prop, updaterscript
MOST IMPORTANT TOOL YOUR BRAIN... AND ALSO LOTS OF TIME...
Click to expand...
Click to collapse
Step one: Installing the JAVA JDK, Cygwin and Setting up the Kitchen
*Before you do anything install the java jdk* (don't skip)
Try this Dsixda Kitchen Install Picture Tutor(recommended)Or
Watch this video guide by gitagaire for how to setup cygwin and kitchen
http://www.youtube.com/watch?feature=player_embedded&v=sYJMdHPD410
Now for the real developing so lets get ready
Click to expand...
Click to collapse
INSTRUCTIONS
1.Download and extract the cygwin_packages.zip
2.Run the set up(make sure there is no previous cygwin installation)
NOTE: INSTALL CYGWIN IN ROOT DISK LIKE C:\
1. Follow the kitchen read me txt!!!
2.Run the set up(make sure there is no previous cygwin installation)
{
"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"
}
Click to expand...
Click to collapse
1.when it shows all the package names, go to the top and select "all default" until it changes to "all install" (you must click on the arrows)
Click to expand...
Click to collapse
1.Download the kitchen from above. Then, extract the kitchen's .zip file to a folder under your home account. Rename the dsixda-android-kitchen-*** folder to just "kitchen". In Cygwin, this folder would depend on what was set for your Cygwin install directory, e.g. C:\cygwin\home\John\kitchen
NOTE!! If your user folder contains spaces (e.g. C:\cygwin\home\John Smith\kitchen), then the kitchen will not function properly. Instead, copy it under C:\cygwin\home\kitchen
1.It's the time now you run the kitchen so follow carefully
2.Run the kitchen and follow
those who have their kitchen like this C:\cygwin\home\John\kitchen use these commands given below.
cd kitchen(enter)
./menu(enter)
Click to expand...
Click to collapse
those who have their kitchen like this C:\cygwin\home\kitchen use these commands given below.
cd ../kitchen(enter)
./menu(enter)
Click to expand...
Click to collapse
Click to expand...
Click to collapse
If every things are right you should have this
congratulations!! you have sucsessfully setup up The kitchen
Click to expand...
Click to collapse
Step Two: Setting up a working folder
THERE ARE TOW METHODS FOR THIS -but i will mention only one for now.
1. WHEN YOU HAVE BASE ROM AVAILABLE.
FIRST METHOD -
1.First our folder structure should look like this:
Code:
cygwin folder/home/your user name/kitchen
1.Inside the kitchen it should look like this:
1. Now we need a base rom for working on, You can any rom but i don't know if it works with stock roms:silly:
Just Place the original rom zip in the original_update folder inside the kitchen.
2.run the cygwin.exe again type:
Code:
cd kitchen(enter)
./menu(enter)
1.now enter option 1, enter again. You should see your rom listed, choose and enter
you will be asked about changing the working folders name, at this point it makes no difference so just continue.
2.congratulations you have a working folder!!!:victory:
Step Two :change/modify/update rom
YOU CAN MODIFY YOUR ROM IN TWO STEPS:
MODIFY USING ANDROID KITCHEN - for basic modification.
MODIFY MANUALLY. - for advanced modification.
1. MODIFYING USING ANDROID KITCHEN
watch this amazing tutorial by neroyoung on how to editing rom with kitchen
NOTE: DON'T FORGET TO DEODEX YOUR ROM
Click to expand...
Click to collapse
2.Modifying manually will be added later on
3.Modifying .9.png's and oter stuff will be added soon saw stay tuned
BUILDING KERNELs​This post includes every thing that helps you develop and make a good kernel for your device
Requirements
1. linux box 32 bit with working gcc. you can use real linux machine or virtual machineOr just simply UBUNTU 10.04 64-bit
2. Sourcery G++ Lite 2009q3-68 toolchain for ARM EABI from http://www.codesourcery.com/ (Linux version without installer arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2)
3. mkbootimg with md5support. got it from http://forum.xda-developers.com/show...&postcount=241 . credit to harish2704
4. split_bootimg.pl (google it)
5. kernel source from http://opensource.samsung.com . i use GT-P3100_ICS_Opensource_Update.zip
6. stock boot.img (or from your custom kernel).
Click to expand...
Click to collapse
Setting up the environment & building the kernel for the first time
Ubuntu 10.04 64-Bit (recommended)
Ubuntu 12.04 64-Bit
Note: If you want to use virtualization software, do not use Virtualbox. You can run into networking issues and so on. I suggest using VMWare Player instead, which is available for free on http://www.vmware.com
Steps :
1. make folder "sgy" in your home. the result is folder "/home/<yourname>/sgy". <yourname> is your linux user name, and from now replace <yourname> with your user name. put all file you already download there
2. extract "GT-P3100_Kernel.tar.gz" from "GT-P3100_GB_Opensource_Update.zip". put also in "sgy" folder
3. open terminal emulator and go to your working path with command
Code:
cd ~/sgy
4. extract your compiler with
Code:
tar -xvf arm-2009q3-68-arm-none-eabi-i686-pc-linux-gnu.tar.bz2
5. create folder "kernel" and extract kernel source there
Code:
mkdir kernel
cd kernel
tar -xvf ../GT-P3100_Kernel.tar.gz
you got 2 folder, "common" and "modules"
6. open folder "common", there is file "Makefile". open with text editor and find line with content "/opt/toolchains/arm-eabi-4.4.3/bin/arm-eabi-". replace with "/home/<yourname>/sgy/arm-2009q3/bin/arm-none-eabi-", don't forget replace <yourname>.
7. in terminal goto folder "common" and load default config for sgy
Code:
cd ~/sgy/kernel/common
make bcm21553_totoro_05_defconfig
8. if you want change you config run
Code:
make menuconfig
9. if you ready to build then run
Code:
make
or if you want to make it faster
Code:
make -j3
10. when complete and no error appear, copy your kernel to "sgy" folder
Code:
cp arch/arm/boot/zImage ~/sgy
11. extract ramdisk from your boot.img
Code:
cd ~/sgy/
perl split_bootimg.pl boot.img
you got "boot.img-kernel" and "boot.img-ramdisk.gz". move "boot.img" and "boot.img-kernel" to other place.
12. repack your new kernel and ramdisk. but first get md5sum of your new kernel
Code:
md5sum zImage
you got something like
Code:
1fd319aa60abc2abae2e5932bcb9fc77 zImage
you need that "1fd319aa60abc2abae2e5932bcb9fc77" write it or copy to text editor. you need run it every time compile new kernel
13.Repack
Code:
chmod +x mkbootimg
./mkbootimg --kernel zImage --ramdisk boot.img-ramdisk.gz --base 0x81600000 --kernelMD5 <your md5sum result> -o boot.img
14.And if you want to make an odin flashble
Code:
tar -cf boot-sgy.tar boot.img
Now you've built you'r kernel
reserved For FAQ
UOT Kitchen customization​Hello everyone, today I'm creating this thread for newbies who want to learn how to use UOT Kitchen so it can be used by the Galaxy Tab 2.
It allows us to mod everything in the phone! You can even choose which to mod.
Prerequisites:
- You current ROM's SystemUI.apk, framework-res.apk and twframework-res.apk
The instructions are as follows:
Step 1: Battery mod
Over here, you can change:
Battery icon
Battery charging animation
Battery style
Battery colour parts
Firstly, just choose a battery bar that you like. (I personally prefer the Honeycomb one)
Secondly, choose the charging animation. (Hybrid looks nice)
Thirdly, you can choose to change the colour parts or leave it as it is.
Fourthly, (optional) you can select Additional options:
Remove % numbers
Remove charging icon
Use gradient colour fill
Well, that's all for battery.
Step 2: Icons
Here you can change:
Smiley icons
Status bar icons
Notification Power icons
This doesn't need much instructions; pick what you like.
Step 3: Status bar
This is probably the most important thing when it comes to theming: the Status Bar!
It allows you to change:
Status bar transparency
Top bar
Add/edit top bar text
Add a header
Add/edit carrier
Add a background on the status bar
Customize notifications' colours
Add/edit footer
Firstly, you need to specify your phone's screen resolution size. (Ours is hdpi.)
Secondly, mix-and-match.
Step 4: Popup (a.k.a Window Animations)
This one is just as important.
It allows you to change:
Add/edit overscroll glow
Edit popup windows
Loading circle
Volume/Download bar
Add/edit list dividers
Same thing, mix-and-match.
Step 5: Lockscreen
This allows you to change:
Lockscreen
Step 6: Window
This allows you to change:
Window animations
It allows us to use the ICS windows animation effect!
Step 7: Fonts
This allows you to change:
System fonts
They have 26 fonts to choose, including the famous Roboto font!
Step 8: Bootanimation
This allows you to change:
System bootanimation
They have loads of bootanimations to choose from. Have fun!
Step 9: File upload
This is where you:
Upload system files for modding
Choosing updater-script type
Apply 9patch autofix
Toggle ThemeChooser preview for ldpi/mdpi/hdpi
Allow to download your settings into a UOT Kitchen-openable format
Just upload your system files.
But remember to choose the updater-script type as Galaxy !!!!!!!!!!!!!!
Step 10: Summary
This is where you can check the status of your mods.
Once it's okay, you can submit the work to the kitchen.
Once you submit it, you'll be given a number. That's the name where your file will be processed under and be shown for download at the "Pickup" section.
(Note: If it gives an error instead of a download post it at the UOT thread)
Thanks for reading this small guide, I'll update it with more info!
Credits ​1. Neroyoung for his video tutorials
2.For lokeshsaini94 for his amazing tutorial
3.For irfanbagus and his nice tutorial that i ported to galaxy tab 2
4.For shakatu fo remembering me to credit people thanks Alot!!!!
And any one that Iforgot to mention lol

[TUT]Series of guides to become a PRO DEV!!!!!!

[Hey guys Aditya here. After a month or so i'm posting tutorial and basic decompiling compiling using adb command!
THINGS YOU WILL NEED​
ON WINDOWS PC
1) Winrar
2) 7zip
3) Java
4) Apktool and adb tools!!!!! (Many tools are available download anyone of them)
5) notepad+ AWESOME THING
ON UBUNTU
1) Java
2) Android SDK
3) APKTOOL ofcourse
Let's get started! I asume you using a Windows PC
First of all download and install JAVA
From here
Download Latest Apktool, extract to :
Windows XP : C:\Document and setting\folder your computer name
Windows 7 : C:\user\folder your computer name
copy your apk & framework-res.apk/SemcGenericUxpRes.apk/framework 2 to same folder with apktool
Now you can start Editing apk
Example Editing Walkman
Open Command Prompt (CMD)
TO DECOMPILE
Code:
java -jar apktool.jar if framework-res.apk
java -jar apktool.jar d semcmusic.apk ( can be whatever name you give to your apk )
Some apks need dependies like tw-framework.apk
Code:
java -jar apktool.jar if framework-res.apk
java -jar apktool.jar if semcgenericuxpres.apk
java -jar apktool.jar d your.apk ( can be whatever name you give to your apk )
Now you can edit what you like to. E.g. Res layout etc!
(For more detalis refer Post #3)
TO COMPILE
To compile back the edited apk
Code:
java -jar apktool.jar yourapkname.apk
For signing apk just drop the android manifest and meta inf of older apk or original apk!!!!!!
F.A.Q
A.I'm getting error while compiling apk??
Check if you have installed framework-res.apk most of compiling errors are becoz of this
B.Can apktool batch decompile and recompile apk's??
Yes,many of modded apk manegers or tools can batch decompile and recompile apk's!!
C.Can i MOD any system app using apk tool?
Yes it can mod all types of apk's just make sure you have correctly installed framework and all other dependices!!!!
D.My modded apk is not working! What should i do???
This question is mostly asked to me! Firstly check weather you have put the Meta-Inf from original APK as this folder contain signatures required for apk to get install.Secondly if you have modded some xml check its correct or some code or values are wrong.If any values or wrong code can lead us to FC or Bootloop..!!!
Using ADB and taking logcat!!!!!
USING ADB AND TAKING LOGCAT
What ia adb??
adb stands for Android Debugging Bridge
For what it is used for
adb is commonly used to pull,push,taking system dumpFOR TAKING LOGCAT
What you will need
On windows
1) Java (Hmmm not needed but u should have. )
2) adb tools by me http://d-h.st/vHJ
Now to make it easy first of all check you have enabled USB Debugging in phone its in Developer Options.
PROCDURE
Make a new folder in C Drive
Extract these tools into it (Asume you folder name is adb)
Now open cmd
Code:
type cd..
cd.. again
cd adb
adb
Now you have installed adb on your PC!
TAKING LOGCAT
Code:
adb logcat>logcat.txt
For only redio related log type
Code:
adb -r logcat>logcatr.txt
For only errors type
Code:
adb -v logcat>logcate.txt
Push and pulling apps from system!
Pushing Apps
Pushing app is installing app on its intenrnal memory!Its simple and doesn't need extra powers!
Code:
adb push yourappname.apk /system/app or /system/framework
Place the app in the adb folder
Pulling Apps
Pulling app is to take out your system apps or frameworks etc!
Code:
adb pull /system/app or /framework yourapp.apk
By this method you can take a system dump
Code:
adb pull /system
Understanding Logcats!!!!!
Some keyword's that represent's error'
Code:
"E/" - error
"E/dalvikvm" - possibly crucial system error
"No such file or directory" - says it all
"couldn't" - android likes that, mostly shows faulty things.
"fail"/"failed" - mostly crucial error
"W/"/"warning" - says it all, but not always warn could be a boot failure cause
"exception"(especially NullPointerException) - points you that something went wrong in framework or application work
These type of errors help us understand the error's and we can easily call out from these bugs or errors!!!
Most common errors occuring in an logcat!
"couldn't find native method", the most common reason of a bootloop.
This error causes most of bootloop problems!!!
For example
Code:
E/dalvikvm( 100): ERROR: couldn't find native method
E/dalvikvm( 100): Requested: Landroid/view/GLES20Canvas;.nStartTileRendering:(IIIII)V
E/JNIHelp ( 100): RegisterNatives failed for 'android/view/GLES20Canvas', aborting
As you can see! The main reson for this error is smali present in android/view of framework.jar called GLES20Canvas.smali
This happens while you are trying to port ROMS!!!!
Now if you are having bugs in other apkor jars how can u find ahem! i.e logcat gives us only the location of smali files and not the name of apk or jar! For that you have to study hole android code sources! Some common folders i have posted here!!
Code:
"com/android/server" - services.jar (there is the same folder at framework.jar but most likely you don't need to touch it).
another place we could be mixed up:
"com/android/internal" - framework.jar
"com/android/internal/policy/impl/" - android.policy.jar
for framework.jar path ends up on internal, which represents telephony folder. policy/impl is the only android.policy.jar folder.
Other frameworks are actually not used in port as they contain core android functionality which is common.
Simple MOD's
Now you guy's have idea about how to take a Logcat,use adb,use apktool.
NOW SOME REAL STUFF
MOD's Related to SystemUI.apk
We will start with simple MOD's! Like replacing icons and to some extend changing layout!
Now we will start will replacing icons inside the SystemUI.apk
First of all pull app from /system/app using adb Refer #2
Then copy that app to apktool folder! Type this cmd
Code:
java -jar apktool.jar d SystemUI.apk
Now go to out folder of SystemUI.apk!
Will find META-INF! RES! ANDROID.manifest
Now Navigate to res/drawable-hdpi as our device uses HPDI
You will find many icons now be carefull here! If youare expert n photoshop or any bitmap editor eit these icons! Or search it! Google it you will find many!
Replace these default icons by ur edited once or downloaded once!!
XML EDITING
Some XML's are not so complicated as other once! Some xml's have just true or false! Example
Code:
<bool name="config_hardwareAccelerated">true</bool>
This tells me that Hardware Acceleration is enabled you can disable it by replacing true by false! You just need to experiment around!
Smali Editing!
Coming soon!
Patching!
Coming soon :d
Changelog
CHANGELOG
1 July Monday 6.04pm -- Inital Editing
Old info but very usefull for noobs. Keep it up
:thumbup:
Hit thanks if you think I helped you.
Sent from LG Nexus 4
Thats really awesome keep it coming am a noob and I rly want to learn n b a part of z dev team
Sent from my GT-I9082 using xda app-developers app
For apk editing there are many 3rd party softwares which doesn't requires one to write such huge codes for signing and etc .
Kinda old method
Make.Believe
Razor! said:
For apk editing there are many 3rd party softwares which doesn't requires one to write such huge codes for signing and etc .
Kinda old method
Make.Believe
Click to expand...
Click to collapse
Yup . Like chotu tools
Sent from my GT-I9082 using xda premium

[BUG REPORT] oat2dex breaks OpenGL/Play Store SOLVED!

EDIT: The latest oat2dex solves this issue altogether.
WTF IS THE PROBLEM?
The OpenGL and Google Play Store refuse to work because baksmali inside the oat2dex tool misinterprets some fields in a single smali file and breaks "services.jar" when deodexing, and the main problem it causes is mistakenly setting your OpenGL version to 0 (instead of 3), basically disabling it.
oat2dex, for some reason, flips just a few specific fields (name and type) when deodexing, as if there is an ambiguity between 2 fields on the same offset.
When you flash the deodexed services.jar back to your phone and clear dalvik-cache, Android re-optimizes it (takes the "classes.dex" inside your new JAR file, does dex2oat on it, and saves it in /data/dalvik-cache/arm/). The deodexed file is broken, so that optimized file is broken too.
You take that broken odex file from dalvik-cache and deodex it again. Since it contains those flipped field names, this time it flips them again but to the correct fields.
The result DEX file you get by that second deodexing is a properly working DEX file, and if you rename it to "classes.dex" and replace "classes.dex" inside your broken "services.jar", you'll get a working "services.jar" and all your OpenGL and Google Play Store problems will disappear immediately.
HOW TO QUICKLY GET A WORKING DEX?
* Extract classes.dex from the JARs, rename them to framework.dex and services.dex.
* Copy them to your internal SD.
* Enable "USB debugging" in Developer options.
* Connect your device to your PC and open Command Prompt:
Code:
[B]adb shell[/B] (confirm ADB on your device)
[B]su[/B] (confirm SU on your device)
[B]dex2oat --dex-file=/sdcard/framework.dex --oat-file=/sdcard/framework.odex[/B]
[B]dex2oat --dex-file=/sdcard/services.dex --oat-file=/sdcard/services.odex[/B]
* Copy these odex files to your PC and deodex them again with oat2dex.
* Rename the new framework.dex and services.dex to classes.dex and add them to their JARs, replacing the broken classes.dex.
JARS AFFECTED BY THIS BUG
framework.jar/classes.dex --- only a single non-critical error in NumberPicker.smali (classes2.dex is fine)
http://forum.xda-developers.com/attachment.php?attachmentid=3338076&d=1432918042
services,jar/classes.dex --- Total of 8 errors, described below...
http://forum.xda-developers.com/attachment.php?attachmentid=3335118&d=1432772056
BUG REPRODUCTION
Requirements:
1) Java installed
2) oat2dex_bug.zip
ZIP contents:
* baksmali.jar
* oat2dex.jar
* boot.oat --- taken from /framework/arm/
* services.dex --- this is "classes.dex" from the deodexed "services.jar" (which breaks OpenGL)
* services-from-dcache.odex --- this is the odex file taken from "/data/dalvik-cache/arm/" that was created by Android after flashing the broken deodexed "services.jar" and clearing dalvik-cache
Reproduction steps:
1) Open "oat2dex_bug" folder, right-click inside it and then select "Open command window here".
2) Write the following lines exactly as follows:
java -jar oat2dex.jar boot boot.oat
java -jar oat2dex.jar services-from-dcache.odex odex
java -jar baksmali.jar -o services-from-dcache services-deodex.dex
java -jar baksmali.jar -o services services.dex
3) With WinMerge, compare folders "services" and "services-from-dcache".
You'll see that only one file has differences, and it's "ActivityManagerService.smali", that's the file you need to fix.
{
"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"
}
In the above images are the only affected areas you need to fix.
Holy @#%. Well done! This issue was a real pain. Thanks
What about fixing framework.jar ? Play store compatibility ?
Sent from my C6903 using XDA Free mobile app
dstrikersZ1 said:
What about fixing framework.jar ? Play store compatibility ?
Sent from my C6903 using XDA Free mobile app
Click to expand...
Click to collapse
framework.jar has only 1 error in NumberPicker.smali, and it's not very critical. Has nothing to do with the Play Store bug. After you've fixed services.jar by deodexing it twice, Play Store is fixed.
IaguCool said:
WTF IS THE PROBLEM?
The OpenGL and Google Play Store refuse to work because baksmali inside the oat2dex tool misinterprets some smali files and breaks "services.jar" when deodexing, and the main problem it causes is mistakenly setting your OpenGL version to 0 (instead of 3), basically disabling it.
oat2dex, for some reason, flips just a few specific fields (name and type) when deodexing, as if there is an ambiguity between 2 fields on the same spot.
When you flash the deodexed services.jar back to your phone and clear dalvik-cache, Android re-optimizes it (takes the "classes.dex" inside your new JAR file, does dex2oat on it, and saves it in /data/dalvik-cache/arm/). The deodexed file is broken, so that optimized file is broken too.
You take that broken odex file from dalvik-cache and deodex it again. Since it contains those flipped field names, this time it flips them again but to the correct fields.
The result DEX file you get by that second deodexing is a properly working DEX file, and if you rename it to "classes.dex" and replace "classes.dex" inside your broken "services.jar", you'll get a working "services.jar" and all your OpenGL and Google Play Store problems will disappear immediately.
JARS AFFECTED BY THIS BUG
framework.jar/classes.dex --- only a single non-critical error (classes2.dex is fine)
services,jar/classes.dex --- described below
BUG REPRODUCTION
Requirements:
1) Java installed
2) oat2dex_bug.zip
ZIP contents:
* baksmali.jar
* oat2dex.jar
* boot.oat --- taken from /framework/arm/
* services.dex --- this is "classes.dex" from the deodexed "services.jar" (which breaks OpenGL)
* services-from-dcache.odex --- this is the odex file taken from "/data/dalvik-cache/arm/" that was created by Android after flashing the broken deodexed "services.jar" and clearing dalvik-cache
Reproduction steps:
1) Open "oat2dex_bug" folder, right-click inside it and then select "Open command window here".
2) Write the following lines exactly as follows:
java -jar oat2dex.jar boot boot.oat
java -jar oat2dex.jar services-from-dcache.odex odex
java -jar baksmali.jar -o services-from-dcache services-from-dcache.dex
java -jar baksmali.jar -o services services.dex
3) With WinMerge, compare folders "services" and "services-from-dcache".
You'll see that only one file has differences, and it's "ActivityManagerService.smali", that's the file you need to fix.
And here are the only differences you find in the file (notice especially the first one and the last one):
Click to expand...
Click to collapse
java -jar baksmali.jar -o services-from-dcache services-from-dcache.dex
Click to expand...
Click to collapse
Error: "Can´t find the file services-from-dcache.dex"
There is no such file in the zip either - only services-from-dcache.odex, but with this file it did not work
moonryder said:
Error: "Can´t find the file services-from-dcache.dex"
There is no such file in the zip either - only services-from-dcache.odex, but with this file it did not work
Click to expand...
Click to collapse
Then you made a mistake somewhere.
IaguCool said:
Then you made a mistake somewhere.
Click to expand...
Click to collapse
tried it again, step 1 and 2 without problems, but step3 the same error as mentioned before
there is a new file in the folder called "services-deodex.dex"
moonryder said:
tried it again, step 1 and 2 without problems, but step3 the same error as mentioned before
there is a new file in the folder called "services-deodex.dex"
Click to expand...
Click to collapse
Ahh I see that oat2dex renames the file for some reason. I fixed line 3 to
java -jar baksmali.jar -o services-from-dcache services-deodex.dex
You could figure that out yourself, you know... by looking inside the folder, I don't see why you repeat every step like a robot uncritically.
IaguCool said:
...I don't see why you repeat every step like a robot uncritically....
Click to expand...
Click to collapse
cause i am not a programmer and a noob in this field contrary to you (maybe you are a genius and i am a little user :angel: )
moonryder said:
cause i am not a programmer and a noob in this field contrary to you (maybe you are a genius and i am a little user :angel: )
Click to expand...
Click to collapse
So basically it's like pushing a screwdriver into a wall socket without knowing what electricity is... I don't get why people that don't develop even try to deodex themselves in the first place. Deodexing is meant for developers, not "little users"...
so its must to be writen GL_ES_VERSION:I
its i/1/L ?
Alvian_P said:
so its must to be writen GL_ES_VERSION:I
its i/1/L ?
Click to expand...
Click to collapse
It's "I" for Integer. Seriously what are you people doing here? It's for *developers*, normal users have nothing to gain from this process.
That's how I have fixed it too, well done
Take care that mWentToSleep must also be fixed.
Both lines are inverted.
Edit: nevermind, your method is inverting both... I did it manually.
Please tell what command compiles the folder "services" into file "services.dex" back?
Bazooka Joe said:
Please tell what command compiles the folder "services" into file "services.dex" back?
Click to expand...
Click to collapse
Google for "smali-2.0.5.jar" for that. baksmali only decompiles.
IaguCool said:
It's "I" for Integer. Seriously what are you people doing here? It's for *developers*, normal users have nothing to gain from this process.
Click to expand...
Click to collapse
@laguCool
1. thx for discovering that problem and its solution
2. all devs began once upon a time, so i think threads like this one are very helpful for users who want to learn and become a dev in future too. So
3. please be soft with all of them who asks questions here.
Thx again for your excellent work and knowledge.
m.
moonryder said:
@laguCool
1. thx for discovering that problem and its solution
2. all devs began once upon a time, so i think threads like this one are very helpful for users who want to learn and become a dev in future too. So
3. please be soft with all of them who asks questions here.
Thx again for your excellent work and knowledge.
m.
Click to expand...
Click to collapse
Well, being soft isn't my thing, it's against my nature...
Anyways, if a person doesn't know what "I" means in Dalvik opcode, they are doing the learning process wrong. They need to be familiar with Dalvik datatypes beforehand.
IaguCool said:
It's "I" for Integer. Seriously what are you people doing here? It's for *developers*, normal users have nothing to gain from this process.
Click to expand...
Click to collapse
just look around , anyways my college is IT
ah sorry if this thread not open for normal users
IaguCool, Big, big Thanks!!! OpenGL worked now! :good:
There is a more simple way for obtain dirty odex from dirty dex file. Just copy deodexed services.dex to sdcard and type in terminal
dex2oat --dex-file=/sdcard/services.dex --oat-file=/sdcard/services.odex
Then copy created /sdcard/services.odex to PC and deodex them again to obtain correct services.dex.
_SIL_ said:
IaguCool, Big, big Thanks!!! OpenGL worked now! :good:
There is a more simple way for obtain dirty odex from dirty dex file. Just copy deodexed services.dex to sdcard and type in terminal
dex2oat --dex-file=/sdcard/services.dex --oat-file=/sdcard/services.odex
Then copy created /sdcard/services.odex to PC and deodex them again to obtain correct services.dex.
Click to expand...
Click to collapse
Thank you I rarely use the terminal so I missed that. I actually copied all /framework/ odex files from dalvik-cache to see if there are more JARs affected by this bug, will add them to the list if I find any.

[TOOL] [Windows] Batch APK Zipalign Tool v 2.0 (23/05/2022)

What's ziplign ?
Read,Android Developers site.https://developer.android.com/studio/command-line/zipalign
zipalign is an archive alignment tool that provides important optimization to Android application (APK) files. The purpose is to ensure that all uncompressed data starts with a particular alignment relative to the start of the file. Specifically, it causes all uncompressed data within the APK, such as images or raw files, to be aligned on 4-byte boundaries. This allows all portions to be accessed directly with mmap() even if they contain binary data with alignment restrictions. The benefit is a reduction in the amount of RAM consumed when running the application.
This tool should always be used to align your APK file before distributing it to end-users. The Android build tools can handle this for you. Android Studio automatically aligns your APK.
Click to expand...
Click to collapse
Why this tool is needed ?
There are a lot of APK modifications on XDA, most of which are done through APKTOOL (Thanks @iBotPeaches for this great tool)
But after apktool compilation, apks needs to be zipalign manually -> which is missing from some these Modded/Distributed Apks found in the forum.
So, I decided to go ahead and make simple tool for this task.
This tool will help end-users/devs in such cases.
How to Use ?
It's One-Click tool, As simple as it gets !
Download & Extract Zip file from attachment.
Put All apks in "Input" folder
Do not leave "SPACES" in file name of APKs For example, Use "AppName_v1.apk" instead of "AppName v171.apk"
Double Click the Batch file (.bat)
You can find zipaliged APKs in "Output" folder after it's done.
That's It !!
PS : (Devs only) Use this tool **AFTER** signing APKs
Users don't need to worry about this because APKs you have/download are already signed.
FAQs
# How to know whether APKs are zipaligned or not after using this tool ?
Check file size of APK Before & After (In Input & Output folders). You will see the differnce in file size on bytes level So, you need to open full property of file via right click.
If file size if exactly the same, means APK was already zipaligned
# How to know whether APKs i have are already zipaligned or not ?
As of now there's no method to my knowledge. So, you need to go through above process.
In general, APKs directly from PlayStore (you backup/apkmirror) are zipaligned so you don't need to zipalign them unless there's some modifications performed on it.
Change log
v1.0 Release 2017
Initial Release
Latest available zipalign binary
v2.0 Release 2022
Based on Android SDK Build-Tools 30.1.0 and should be compatible with latest Android versions (A9-A12+)
Tried this. Nothing in the output folder
Serpentinefire76 said:
Tried this. Nothing in the output folder
Click to expand...
Click to collapse
I'm not actively maintaining this tool due to personal commitments. Theoretically it should still work even with older binaries but if you are looking for specific support I suggest search for other/newer threads.
jineshpatel30 said:
I'm not actively maintaining this tool due to personal commitments. Theoretically it should still work even with older binaries but if you are looking for specific support I suggest search for other/newer threads.
Click to expand...
Click to collapse
I tried it again. It works like a charm. Awesome. Thank you!
Update after a long time.​
v2 is based on Android SDK Build-Tools 30.1.0 and should be compatible with latest Android versions (A9-A12+)
Happy Modding!
i get this error a mod apk
Code:
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES: Failed collecting certificates for /data/app/vmdl262490375.tmp/base.apk: Failed to collect certificates from /data/app/vmdl262490375.tmp/base.apk: META-INF/APKEASYT.SF indicates /data/app/vmdl262490375.tmp/base.apk is signed using APK Signature Scheme v2, but no such signature was found. Signature stripped?]
Command file current zipalign.bat:
for %%X in (.\Input\*.apk) do (
echo Zipaligning - %%~nX.apk
.\Tools\zipalign -cv 4 %%X
.\Tools\zipalign -fv 4 %%X .\Output\%%~nX.apk
)
Maybe it should be reversed like this:
for %%X in (.\Input\*.apk) do (
echo Zipaligning - %%~nX.apk
rem To align infile.apk and save it as outfile.apk
.\Tools\zipalign -fv 4 %%X .\Output\%%~nX.apk
rem check alignment outfile.apk only after having zipalign (does not modify file)
.\Tools\zipalign -cv 4 %%X
)

Categories

Resources