[Sony Cross-Device General] xkeita:
Hey guys! Since deodexing older Z series phones with this latest update has been a pain in the *** for deodexing here's a detailed guide on how to get a correctly deodexed system folder and avoid bootloops...

First part: Getting files from the phone.

To get the files from our phone first we'll have to install ADB Drivers, you can find them here on xda or go google it. Once you have adb drivers installed go to the folder where you installed them. Press Shift while right clicking on the folder and select Open command promp.

Here are the commands to get the folders with apk, note that you'll find them in your C:\ folder.

- To get app folder:

adb pull /system/app /app/

- To get framework folder:

adb pull /system/framework /framework/

- To get priv-app folder:

adb pull /system/priv-app /priv-app/

You will get apk's only on app and priv-app folders, the only folder with odex files (arm folder) will be framework.

------------------------------------------------------------------------------------------------------------

Now let's go for sqsh files to get odex files for app and priv-app folders.

- To get odex.app.sqsh:

adb pull /system/odex.app.sqsh

- To get odex.app.sqsh:

adb pull /system/odex.priv-app.sqsh

You'll find these files inside the same folder where adb.exe is

Second part: Unpacking .SQSH files

To resume a little, you may refer to IaguCool's guide

Once you have downloaded SquashFS Tool, move both .sqsh files to the folder.

When you have opened the command promp use these codes to extract files...

> To get odex files for app folder (After extracting rename the squash-root folder to app):

unsquashfs -no-xattrs odex.app.sqsh

> To get odex files for priv-app folder (After extracting rename the squash-root folder to priv-app):

unsquashfs -no-xattrs odex.priv-app.sqsh

Third part: Merging files

Create a folder named system and move app, framework and priv-app folders from C:\ to the new folder.

After that grab the folders you extracted with SquashFS Tool and merge them with app and priv-app folder.

After doing this move SemcGenericUxpRes folder to priv-app folder

Fourth part: Deodexing

Download JoelDroid's Lollipop Batch Deodexer and replace the file named oat2dex.jar found on /tool folder with this one: Latest oat2dex

Then open the program and select the /system/ you've created to start the process.

Once it has finished, grab SemcGenericUxpRes folder and move it back to /framework

Now you can either replace folders manually on your phone using TWRP by moving the deodexed system folder to your phone and mounting System partition, erasing app, framework and priv-app folder and then pasting the ones from the deodexed folder. OR make a flasheable zip.

How to manually move folders to /system partition

> Boot to recovery (TWRP MANDATORY)

> Mount system partition

> Go to file manager and go to: /system/ partition

> Manually delete app, framework and priv-app folder (you must first open the folder, then open the menu and delete)

> Then go to where you put the deodexed folders, open app folder, open menu, choose copy and paste on /system/ folder, same process for priv-app and framework.

> Once you're done go to Wipe option, choose advanced wipe and wipe Dalvik-cache and cache.

> Boot and you're good to go! No need to fix permissions

In both cases, after you have either flashed or replaced the folders, go to Wipe option > Advanced Wipe and clean Dalvik-cache and cache to avoid problems.