Hello, i want to know how can i assemble the DEX Files after extracting them out? i tried the command :
Code:
java -jar baksmali.jar out
but i get this error
Code:
C:\>java -jar baksmali.jar out
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.RuntimeException: out: not a file
at org.jf.dexlib.Util.FileUtils.readFile(FileUtils.java:77)
at org.jf.dexlib.DexFile.<init>(DexFile.java:288)
at org.jf.baksmali.main.main(main.java:161)
i can extract it out using :
Code:
java -jar smali.jar classes.dex
any help will be appreciated
instead out out, put the filename? classes.dex? see if that works. I havent used baksmali/smali but i would imagine thats whats happening as the exception says not a file lol
I think the Command you're Looking for is
run following from command line: java -jar baksmali.jar -o classout/ classes.dex
that just extracts the file ;/ i need to put the extracted files back ;(
I think the Command you're Looking for is
run following from command line: java -jar baksmali.jar -o classout/ classes.dex
Click to expand...
Click to collapse
Developed and tested on Linux. Its a shell script that requires the Android SDK to be installed with the tools directory in the PATH variable.
INTRO
Android Binary Resource Compiler (abrc). This is a command-line
script to compile resources such as NinePatch PNGs and layout XML
files to Android binary format. The compiled resources named in the
command are extracted and saved out into a separate location. This
script was developed as an alternative to using Eclipse and "unzip" to
compile and extract NinePatch PNGs during the creation of custom
Android UI themes.
USAGE
abrc usage
abrc help
abrc [options] compile <project dir> <output dir> <resource file1> <resource file2> ...
abrc [options] setup <project dir>
OPTIONS:
-v Enable verbose output
-o Overwrite files without prompting
Click to expand...
Click to collapse
COMPILE
The compile operation compiles the resources in the <project dir>
location. This can be any Android Eclipse project directory which
contains the resources you wish to compile and extract. You can also
use this script's "setup" syntax to create a minimal project without
using Eclipse. See the SETUP section below for more information.
The named resource files <resource file1> <resource file2>, etc., are
then extracted into the <output directory>. Parent path components in
the resource file names are preserved and also determine the extracted
location within the output directory.
Example:
Consider the following path in "MyProject" which contains, among other
things, the statusbar_background.9.png file. This file is in the format
created by draw9patch program.
MyProject/res/drawable-mdpi/statusbar_background.9.png
The following command compiles the resources in MyProject and writes
the output to the MyTheme/framework-res directory using the leading
path components of the specified resource file(s). I.e., In this
example the resulting output file is
MyTheme/framework-res/res/drawable-mdpi/statusbar_background.9.png
abrc compile MyProject MyTheme/framework-res res/drawable-mdpi/statusbar_background.9.png
Click to expand...
Click to collapse
SETUP
The setup operation is completely optional. It creates a minimal
project skeleton for compiling resources. Eclipse projects can also
be used in the compile step above.
abrc setup MyProject
Click to expand...
Click to collapse
The above command creates the following directory structure/files:
MyProject/res/drawable
MyProject/res/drawable-mdpi
MyProject/res/drawable-hdpi
MyProject/res/layout
MyProject/AndroidManifest.xml
Click to expand...
Click to collapse
Copy your resources into the appropriate location within the project
and then use the compile operation to compile and extract the binary
files.
How does it work? It calls aapt and then unzip compiled resources? It's too small to do this directly.
Yes, that's what it does. It's just a shell script so you can look at it and see. There are some comments in the script that explains things.
It relies on the Android SDK which is assumed to already be installed.
Sent from my FroyoEris using XDA App
Nice! Makes a lot of things easier.
how can we use this script with windows 7?
h_zee13 said:
how can we use this script with windows 7?
Click to expand...
Click to collapse
There's a chance it might work using Cygwin (www.cygwin.com). Be sure to include the zip compression utilities package when installing.
this is great! i hated having to fire up eclipse for this. thanks!
This is a great tool. It was a little confusing at first, I don't think I had my path set up correctly. I've found the easiest way to use this, for me anyway, was to use the setup command and make a new folder with it, I deleted the m and ldpi folders because i'm not using them, copied my .9s into the drawable-hdpi folder, and from inside the "project" directory ran,
abrc compile . done res/drawable-hdpi/*
This compiles all the images in there and places them in the done folder.
Hope i'm not stepping on any toes, just what I found to be the easiest after placing aapt in /usr/tools/ and android.jar in /usr/ as I was kinda confused when I first downloaded it.
abrc for cygwin
h_zee13 said:
how can we use this script with windows 7?
Click to expand...
Click to collapse
I've edited this script and it works on cygwin. go here and download it. -> https ://plus.google.com/118270346235276777406/posts/EJGWifY5kTh
so im trying to get this to work but no luck if someone could help me
first i set paths
Code:
export PATH=${PATH}:/home/suphi/Documents/android-sdk-linux/tools:/home/suphi/Documents/android-sdk-linux/platform-tools:/home/suphi/Documents/android-sdk-linux/apktool
then i run this code
Code:
abrc compile before after res/drawable-hdpi/*
then i get this error
Code:
Using aapt to compile resources to /tmp/resources-82KEfVduDK.zip
W/asset ( 4429): Asset path /home/suphi/Documents/android-sdk-linux/android.jar is neither a directory nor file (type=1).
ERROR: Asset package include '/home/suphi/Documents/android-sdk-linux/android.jar' not found.
i also put the aapt from platform-tools into tools folder as i was getting errors before saying aapt was missing from tools folder
Splder said:
so im trying to get this to work but no luck if someone could help me
<snip>
i also put the aapt from platform-tools into tools folder as i was getting errors before saying aapt was missing from tools folder
Click to expand...
Click to collapse
There are several 'tools' folders. It belongs in the platforms/android-N/tools folder where the 'N' in android-N is a number (API level). Making copies might also cause problems, so I would try and figure out why its missing from the tools directory in the first place.
Ken
no need to use abrc to prepare compiled 9patch pngs, just using aapt in android-sdk is ok, the command line is like this: aapt.exe c -v -S /path/to/project -C /path/to/destination
Hi @kellinwood and ALL
Had being advised by your awesome work by @Modding.MyMind here, I've came to ask for your orientation.
At the moment, AFAIK, we are uncapable to compile xml's without providing all the resources addressed by them.
My objective here is try to compile modded XMLs only. While trying to accomplish this task, I've got to the following Python script that will generate all the /res/values/*.xml's that addresses local resources.
Code:
import os
import shutil
input_folder = '/home/Kdio/apk/Phone'
output_folder = os.path.join(os.path.dirname(os.path.abspath(__file__)), "out")
if not os.path.isdir(output_folder):
os.mkdir(output_folder)
tokens = {}
xmlExist = {}
for root, dirs, files in os.walk(input_folder):
for f in files:
inputFile = os.path.join(root, f)
filename, ext = os.path.splitext(inputFile)
if (ext != '.xml'):
continue
xmlExist[os.path.basename(inputFile)] = 1
with open(inputFile, 'r') as f:
for line in f:
token = ''
read_token = False
for c in line:
if (c == '@'):
read_token = True
continue
if (read_token is True):
if (c == '"'):
read_token = False
tokens[token] = 1
token = ''
else:
token += c
f.close()
xmls = {}
for token in sorted(tokens):
if (token == 'null'):
continue
if (':' in token):
continue
#token = token.split(':')[-1]
head, tail = token.split('/')
if (head == 'anim'):
continue
if ((tail + '.xml') in xmlExist.keys()):
continue
if (not head in xmls.keys()):
xmls[head] = {}
xmls[head][tail] = 1
#for xml in xmls:
# for res in xmls[xml]:
# print(xml + ' -> ' + res)
for xml in xmls:
xmlText = '<?xml version="1.0" encoding="utf-8"?>\n<resources>\n'
for res in xmls[xml]:
if (xml == 'bool'):
xmlText += ' <bool name="' + res + '">false</bool>\n'
if ((xml == 'id') or (xml == 'drawable') or (xml == 'style') or (xml == 'layout')):
xmlText += ' <item type="' + xml + '" name="' + res + '">false</item>\n'
if (xml == 'array'):
xmlText += ' <string-array name="' + res + '">\n <item>array-dummy</item>\n </string-array>\n'
if (xml == 'attr'):
xmlText += ' <attr name="' + res + '" format="string" />\n'
if (xml == 'color'):
xmlText += ' <color name="'+ res + '">#00000000</color>\n'
if (xml == 'dimen'):
xmlText += ' <dimen name="' + res + '">1.0dip</dimen>\n'
if (xml == 'integer'):
xmlText += ' <integer name="' + res + '">1</integer>\n'
if (xml == 'plural'):
xmlText += ' <plurals name="' + res + '">\n <item quantity="other">a</item>\n <item quantity="one">b</item>\n </plurals>\n'
if (xml == 'string'):
xmlText += ' <string name="' + res + '">a</string>\n'
if (xml == 'fraction'):
xmlText += ' <fraction name="' + res + '">1%</fraction>\n'
xmlText += '</resources>\n'
f = open(os.path.join(output_folder, xml + 's.xml'), 'w')
f.write(xmlText)
f.close
Please edit 'input_folder' accordingly.
Then, issuing the below command:
Code:
aapt p -f -M onlyXMLs/AndroidManifest.xml -F onlyXMLs.zip -S onlyXMLs/res -I android.jar
What I get from it now are errors regarding external resources references not being found only.
This is exactly the point where my shallow knowledge ends ...
Could you (and all) someway point me the light (if there is any) how could we 'dummy' external resources as done with local ones?
Thank you all.
Nice regards.
.
Hi guys,
Today I'm going to share something with you guys which I found while messing up with my stock SystemUI
This guide have 2 parts, so let's begin
1. How to change the transparency of bottom dragger without editing png: this will help you when you want to make the bottom dragger transparent but don't have a png with your preferred transparency range
How to:
1. Decompile your SystemUI.apk
2. Enter your decompiled SystemUI folder and go to res/drawable/tw_status_bar_close.xml
3. Focus on this line:
Code:
<item android:state_pressed="true" android:drawable="@drawable/tw_status_bar_close_on" />
Now edit it to be like this:
Code:
<item android:state_pressed="true" android:drawable="@colors/close_on"/>
4. Now focus on this one:
Code:
<item android:drawable="@drawable/tw_status_bar_close_off" />
Now edit this one like this:
Code:
<item android:drawable="@colors/close_off" />
5. Now go to res/values/colors.xml
6. Add this above </resources>:
Code:
<color name="close_on">#00000000</color>
<color name="close_off">#00000000</color>
7. Now change the color and transparency level to whatever you want
8. Now recompile, push, set permissions and reboot
2. How to remove the carrier name text at the dragger:
The text on the dragger is annoying so if you want to remove it and don't know how follow this
How to:
1. Decompile SystemUI.apk
2. Enter your decompiled SystemUI folder and go to res/layout and open tw_status_bar_expanded.xml(if your device is single sim) or tw_status_bar_expanded_dual.xml(if your device is dual sim)
3. Now find this line:
Code:
<TextView android:textAppearance="@style/TextAppearance.StatusBar.Expanded.Network" android:gravity="center" android:layout_gravity="bottom" android:id="@id/carrier_label" android:layout_width="fill_parent" android:layout_height="@dimen/tw_close_handle_height" android:layout_marginBottom="10.0dip" />
4. Now focus here:
Code:
android:layout_height="@dimen/tw_close_handle_height"
And edit it like this:
Code:
android:layout_height="0.0dip"
5. Done ! Now recompile, push, set permissions and reboot
If you didn't knew it before, learn from here and wanna include it on your mod, please don't forget to give me the credits on the thread
Nice guide!
Thanks you
Hi guys,
today I'm here to show you how can you apply the status bar and notification panel color changer mod of sir @b16h22 on your 4.1 TW ROM..... this is a really easy and excellent mod which will help you have your desired color on your notification panel and status bar
Requirements:
1. Brain
2. Patience
3. Experience
4. apktool or something like it
How to apply status bar color changer:
1. Decompile your SystemUI.apk
2. Go to res/layout/tw_status_bar.xml(if you're device is single sim)/tw_status_bar_dual.xml(if your device is dual sim)
3. Find this:
Code:
<LinearLayout android:orientation="horizontal" android:id="@id/icons" android:paddingLeft="0.0dip" android:paddingRight="2.0dip" android:layout_width="fill_parent" android:layout_height="fill_parent">
put this above it:
Code:
<com.b16h22.statusbar.StatusBar
android:id="@+id/status_bar" android:layout_width="fill_parent" android:layout_height="fill_parent" />
4. Attach the contents of colorchangerfiles.zip to your decompiled SystemUI
5. Recompile and now decompile again
6. Time for id matching......Go to res/values/public.xml and find this:
Code:
<public type="id" name="status_bar" id="*x********" />
take it's public id and go to smali/com/b16h22/statusbar/StatusBar.smali
and replace the public id you got on line no.23 with:
Code:
const v2, 0x7f090026
7. Recompile, sign, push with StatusBarMods.apk, reboot and enjoy
!!!
How to apply notification panel color changer:
1. Decompile your SystemUI.apk
2. Go to res/layout/tw_status_bar_expanded.xml(if your device is single sim)/ tw_status_bar_expanded_dual.xml(if your device is dual sim)
3. Find line no.5 which is this:
Code:
<FrameLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_marginBottom="@dimen/tw_close_handle_underlap">
put this above it:
Code:
<com.b16h22.statusbar.Pulldown
android:id="@+id/view" android:layout_width="fill_parent" android:layout_height="wrap_content"
android:layout_weight="1.0" />
4. Attach the contents of colorchangerfiles.zip to your SystemUI
5. Recompile and decompile again
6. Time for id matching...... go to res/values/public.xml and find this:
Code:
<public type="id" name="view" id="*x********" />
take it's public id and go to smali/com/b16h22/statusbar/Pulldown.smali
and replace the public id you copied with this on line no.23 with:
Code:
const v2, 0x7f090027
7. Recompile, sign, push with StatusBarMods.apk, reboot and enjoy !!!
Link:
colorchangerfiles.zip:
https://www.androidfilehost.com/?fid=817550096634757787
StatusBarMods.apk:
https://www.androidfilehost.com/?fid=817550096634757784
Credits:
@b16h22 for making
NOTE: You must need transparent status bar and notification panel to apply this mod......
I want to change the values below found in res\values\integers.xml of framework-res.apk:
<integer name="config_screenBrightnessSettingMinimum">10</integer>
to
<integer name="config_screenBrightnessSettingMinimum">1</integer>
EDIT: I changed these values and they had no effect whatsover on LineageOS 18.1, Pixel 3xl
Option 1 - Replace framework-res.apk - This can't be done due to stricter app signatures
1. Decompiled framework-res.apk with apktool
2. Make changes to integers.xml
3. Recompile framework-res.apk with apktool
4. Replace the META-INF folder & ApkManfiest.xml in the new apk with the META-INF folder & ApkManifest.xml from the original framework-res.apk
5. Reboot to recovery & sideload the new framework-res.apk
Option 2 - Create a Magisk Module to virtually replace framework-res.apk - This can't be done due to stricter app signatures
Steps 1-4 are the same as option 1.
5. Create module.prop
6. Create zip [Module Name].zip with module.prop & system\framework\framework-res.apk inside
7. Place zip in data\adb\modules\
8. Reboot, enable module in Magisk
Option 3 - Create a Magisk Module to virtually replace an RRO apk that targets android(the same target as frameworks-res.apk) - No need to replace an existing RRO, just adb push your RRO apk to system/product/overlay/[RRO Name]/ or system/vender/overlay/[RRO Name]/
1. Create the xml file, [Module Name]\res\values\integers.xml, with the code I wish to overlay in framework-res.apk:
XML:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="config_screenBrightnessSettingMinimum">1</integer>
</resources>
2. Create an AndroidManifest.xml with the following code:
XML:
<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.bens.myBrightnessOverlay">
<application android:hasCode="false"/>
<overlay android:isStatic="true" android:targetPackage="android"/>
</manifest>
3.Use Android SDK Build Tools to create the replacement RRO apk.
Use the devices original framework-res.apk and the files created in Steps 1 & 2.
Code:
aapt2 compile --dir [Module Name]\res\ -o compiled\
aapt2 link -o MyBrightnessOverlay.apk -I framework-res.apk compiled/values_integers.arsc.flat --manifest
[Module Name]/AndroidManifest.xml
4. Rename the new apk after the RRO apk you plan to replace (system\product\overlay\AccentColorAmethyst\AmethystOverlay.apk).
5. Create module.prop
6. Create zip named [Module Name].zip with the module.prop & \system\product\overlay\AccentColorAmethyst\AmethystOverlay.apk inside
7. Place zip in data\adb\modules\
8. Reboot, enable module in Magisk