2020-09-09 18:53:54 +00:00
Table of Contents
=================
* [Deodex services.jar ](#deodex-servicesjar )
* [Pre-Check ](#pre-check )
* [Android 9.0 Pie ](#android-90-pie )
* [VDEX ](#vdex )
* [ODEX ](#odex )
Created by [gh-md-toc ](https://github.com/ekalinin/github-markdown-toc )
2018-08-25 17:36:36 +00:00
# Deodex services.jar
2018-08-25 17:41:56 +00:00
Here you can find instructions on how to manually deodex `services.jar` as preparation for Signature Spoofing support.
2018-08-25 17:47:42 +00:00
If you want to check beforehand (or afterwards), if your ROM supports Signature Spoofing, use this [tool ](https://f-droid.org/de/packages/lanchon.sigspoof.checker/ ).
2018-08-29 15:58:42 +00:00
## Pre-Check
2018-08-29 15:23:02 +00:00
2019-02-08 20:29:32 +00:00
If your `/system/framework/services.jar` file contains the file `classes.dex` , you can skip deodexing and start patching right-away, else following these instructions.
2018-08-29 15:23:02 +00:00
2018-09-03 18:17:55 +00:00
## Android 9.0 Pie
2018-11-07 15:23:55 +00:00
Android 9.0 is currently not supported by smali/baksmali (more precisely O/DEX format 039 and OAT format changes are not yet implemented).
2018-09-06 16:21:59 +00:00
2018-11-07 15:23:55 +00:00
VdexExtractor will create CompatDex for Android 9.0 (more precisely VDEX 019 files) instead of DEX. Theese CDEX files can only be manually converted to DEX on a GNU/Linux or MacOS PC, see [this instructions ](https://github.com/anestisb/vdexExtractor#compact-dex-converter ).
2018-09-03 18:17:55 +00:00
2018-08-25 17:36:36 +00:00
## VDEX
2018-08-25 17:41:56 +00:00
If you can see `/system/framework/oat/[arch]/services.vdex` , where [arch] is the device architecture (arm, arm64, x86 or x86_64), you should follow theese instructions.
2018-08-25 17:36:36 +00:00
the instructions are basically simple, though plenty commands:
* connect phone with PC while in TWRP, mount `/system` **read-write**
2018-08-29 15:58:42 +00:00
* get latest `vdexExtractor`
2018-08-25 17:47:42 +00:00
* [vdexExtractor Sources ](https://github.com/anestisb/vdexExtractor )
2018-08-25 17:36:36 +00:00
* zip/unzip utilities for commandline (or some UI tool)
* common sense on using commandline (or some UI tool instead)
```
adb pull /system/framework framework
cp framework/services.jar services.jar-backup
```
2018-08-25 17:41:56 +00:00
now deodex `services.vdex` :
2018-08-25 17:36:36 +00:00
```
vdexExtractor -i framework/oat/[arch]/services.vdex --ignore-crc-error
```
this will create the following file:
* framework/oat/[arch]/services.apk_classes.dex
2018-09-20 20:02:09 +00:00
if it's properly been created rename it to classes.dex and add it to `services.jar` , if there are additional files like services.apk_classes2.dex, rename them to classes2.dex and so on and add them to services.jar like:
2018-08-25 17:36:36 +00:00
```
mv framework/oat/[arch]/services.apk_classes.dex classes.dex
2018-09-20 20:02:09 +00:00
... mv for other dex files ...
2018-09-20 19:55:54 +00:00
zip -j framework/services.jar classes*.dex
2018-08-25 17:36:36 +00:00
```
next install the new `services.jar` to device:
```
adb push framework/services.jar /system/framework
adb shell
chmod 0644 /system/framework/services.jar
chown root:root /system/framework/services.jar
```
unmount `/system` and flash the NanoDroid-Patcher.
If something goes wrong you still have the unpatched `services.jar` , as we created a copy named `services.jar-backup` .
## ODEX
2018-08-25 17:41:56 +00:00
If you can see `/system/framework/oat/[arch]/services.odex` , where [arch] is the device architecture (arm, arm64, x86 or x86_64), you should follow theese instructions.
2018-08-25 17:36:36 +00:00
the instructions are basically simple, though plenty commands:
* connect phone with PC while in TWRP, mount `/system` **read-write**
2018-08-29 15:21:30 +00:00
* get latest `baksmali.jar` and `smali.jar`
2018-08-25 17:47:42 +00:00
* [smali Sources ](https://github.com/JesusFreke/smali )
2018-08-25 17:36:36 +00:00
* zip/unzip utilities for commandline (or some UI tool)
* common sense on using commandline (or some UI tool instead)
```
adb pull /system/framework framework
cp framework/services.jar services.jar-backup
```
```
2018-08-29 15:21:30 +00:00
java -jar baksmali.jar x framework/oat/[arch]/services.odex -d framework/[arch] -d framework/ -o services-new
2018-08-27 17:06:25 +00:00
java -jar smali.jar a services-new -o classes.dex
```
2018-08-29 15:58:42 +00:00
somestimes baksmali.jar can't find the bootclasses file itself, in this case pass it manually using `-b` , for example:
`-b framework/[arch]/boot.oat`
2018-08-27 17:06:25 +00:00
in any case, if a new classes.dex was successfully created in the services-new directory, re-package it into the services.jar we previously pulled:
2018-08-25 17:36:36 +00:00
```
2018-09-20 19:55:54 +00:00
zip -j framework/services.jar classes*.dex
2018-08-25 17:36:36 +00:00
```
next install the new `services.jar` to device:
```
adb push framework/services.jar /system/framework
adb shell
chmod 0644 /system/framework/services.jar
chown root:root /system/framework/services.jar
```
unmount `/system` and flash the NanoDroid-Patcher.
If something goes wrong you still have the unpatched `services.jar` , as we created a copy named `services.jar-backup` .