This tutorial is for people building roms based on CyanogenMod only !
This tutorial will explain how to use a custom CyanogenMod apk theme as the default when building roms
Things you will need
1. Java JDK and Java JRE installed
2. ApkTool - Download
3. Notepad++ - Download
4. Theme apk file
5. Your custom rom
Step 1
Download and extract apktool into a folder on the root of you drive, call the folder apk
Once extracted you you have three files like this
{
"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"
}
Step 2
If you have already packaged your rom use something such as WinRAR to extract it to a folder.
Once extracted it should look similar to this
Step 3
In your rom folder navigate to system/framework and look for the framework-res.apk file
It should look like this
Step 4
Copy the framework file to your apktool folder
Your apk tool folder should now look like thisView attachment 2484553
Step 5
Now copy your theme into the same folder
The folder should now look like thisView attachment 2484556
Step 6
Run command prompt and enter the following commands
Code:
cd C:\apk
Code:
apktool if framework-res.apk
Code:
apktool d <whatever your theme apk is called>.apk
Your CMD windows should now look like this
Step 6
Go back to your apktool folder and now you should have a folder called <your theme name>.apk
It will look like this View attachment 2484571
Step 7
Go inside that folder and open AndroidManifest.xml with Notepad++
Step 8
Once you open this file you need to look for two strings, they should look similar to these ones
Step 9
Once you have found these strings minimize the Notepad++ window and navigate back to your rom folder
Now navigate to system and open build.prop with Notepad++ and add these two lines
Code:
persist.sys.themeId=~~~~~~
persist.sys.themePackageName=+++++++++
Replace "~~~~~" with theme id from AndriodManifest.xml
Replace "+++++" with package name from AndroidManifest.xml
Mine would look like this
Now save build.prop
Step 10
Go to your rom folder and navigate to system/app and copy your theme apk inside of this folder
Now zip your rom back up and flash it
When your rom boots you should now see you custom theme
Note
If you cant get apktool to work and it keeps saying something along the lines of "java is not an exacutable command"
Make sure you have installed the Java SDK and Java JRE and navigate to C:\Program Files (x86)\java
and you should see a folder called "jdk1.7.0_45" or "jdk" with different numbers after it
Now go to control panel and on the right hand side click "Advanced System Settings"
Then click "environment variables"
Under "system variables" create a new variable and call it JAVA_HOME
In variable value put the path of your java sdk folder so it would be
C:\Program Files (x86)\Java\jdk<what ever numbers are here on your pc>
Or 32 bit users
C:\Program Files\Java\jdk<what ever numbers are here on your pc>
Now before you save the environment variable put the path in speech marks like this
Now save and reboot
And for CM12.1 its possible? Or CM11?? I try but not work :/
Related
So, here i'm again porting a tutorial based on DSM_'s Tut
What do you need:
JRE (Java Runtime Environment)
Install:
Windows:
Download apktool
Download apktool-install-windows
Unpack both pakages you will get three files, copy those files to your Windows directory i.e. C:\WINDOWS
Decoding files:
Open Command. Run>cmd
Type-
Quote
apktool d file.apk [directory]
Example - apktool d D:\nfsshift.apk D:\nfsshift
Done!
{
"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"
}
FrameworkFiles
Apktool needs the framework files to decode and build apks.
Standard framework is embedded into apktool, so you don't need to do anything for most apk files. But some manufacturers, for example Samsung, add their own framework files and use them in system apps. To use apktool against such apps, you must pull framework from a device and install/register it to apktool.
For Example, you want to decode TouchWizLauncher.apk from Android v2.2 of Galaxy 5. If you try to do that, you will get an error message:
You need to install framework in apktool Type-
apktool if [framework location]
I have the got the framework-res.apk & twframework-res.apk by extracting the ROM. You can also copy it from your phone. But take care you must copy framework.apk from that ROM in which you got the Application file.
Then try again
Now is working.
How to build decoded files:
Just type
apktool b [directory in which you have decoded the files]
Example - apktool b D:\nfsshift
Done!
You will find the apk file inside the decoded directory, like I found it in - D:\nfsshift\dist\nfsshift.apk
Now you need to sign your APK file.
How to Sign APK files:
When publishing an application or a custom rom you need to sign the .apk or .zip files with a certificate using a private key. The Android system uses the certificate to identify the author of an application and establish trust relationship between applications. The classic way of doing this was to use keytool then sign it with jarsigner. In this tutorial i’ll explain an alternative method which is relatively easy to use for most people using a tool called SignApk.jar.
First download the SignAPK tool - http://www.mediafire.com/?rw57ftajd6nm81s
Extract them to a directory you will remember. I have put them in C:\SignApk
Now just open cmd and type -
Quote
cd C:\SignApk
java -jar signapk.jar certificate.pem key.pk8 your-app.apk your-app-signed.apk
Example - java -jar signapk.jar certificate.pem key.pk8 D:\nfsshift\dist\nfsshift.apk D:\nfsshift\dist\nfsshift-signed.apk
Your APK is signed and can be installed.
●๋•ηι¢є ιηƒσ●๋•
Sent from my GT-S7500 using xda app-developers app
I know this is an old post but I need some help. I have the apktool, dex2jar and jd-gui in a folder on my Desktop
I installed the framework-res.apk and it installs into a different folder. Do I need to have the Framework folder into the same folder as the other files or will it be able to locate the framework files no matter where they are.
The reason I ask is because even though I have installed the framework, I am still getting error message when attempting apktool d filename.apk. Any ideas would be helpful, thank you
This will show you how to Decompile and Recompile SecPhone.apk (Deodexed) for Jellybean 4.1.1 and 4.1.2
Tools Needed:
This zip file: http://www.mediafire.com/?0b2ad2ow254ou3a
Java jdk and environment variables set correctly (if you don't know how, Google it)
Notepad++
7Zip
Decompile:
1. Download attached files and unzip folder to Desktop.
2. Place SecPhone.apk in Tools folder you just downloaded.
3. Hold Shift and right click inside of folder then click "Open command window here". Make sure no files are selected or it will not show.
5. Type apktool d SecPhone.apk and hit enter. This will create a folder called SecPhone.
6. You’re done you have decompiled the apk.
Recompile:
1. Hold Shift and right click inside of folder then click "Open command window here".
2. Type apktool b SecPhone nSecPhone.apk and hit enter. This will error and look something like this:
{
"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"
}
3. Now look at the code. If you look you will see there are 3 errors like this: Desktop\Tools\SecPhone\res\values-es\strings.xml:195: error: (they might look slightly different with your apk).
4. The things you need to fix this are right here (values-es) refers to a folder in the apk Desktop\Tools\SecPhone\res\ and strings.xml refers to an xml file inside that folder. Also if you read the whole line you will see it is some sort of format error. So go to Desktop\Tools\SecPhone\res\values-es\strings.xml and open it with Notepad++.
5. Now refer back to the error log and you will see values-es\strings.xml:195 the 195 refers to the line in the file that is causing the error. Scroll to that line, it says something like "%1$d% del ciclotranscurrido. So what’s the error? Let’s find out. Copy the code between the "" in this case its throttle_time_frame_subtext.
6.Now go to Desktop\Tools\SecPhone\res\values\strings.xml and open that with Notepad++ and search for code you just copied throttle_time_frame_subtext and compare the two files. You can see the difference error code has this %1$d% and the correct code has %1$d٪ so correct the code and save the file. Now do this for all 3 errors.
7. Now with all errors fixed we can Recompile so type apktool b SecPhone nSecPhone.apk and press Enter. This time it will complete without errors.
8. Open original SecPhone.apk with 7zip and open new nSecPhone.apk with 7zip and copy META-INF and AndroidManifest.xml from originalapk to new apk. Rename new apk to SecPhone.apk and its ready to be flashed. Don't forget to Zipalign. DONE!
If this helps you please don't forget the thanks button
Reserved
Thanks for this mate.. I was wondering for a long time on this error
sent from here, there, somewhere!!
Thanks for your work!
{
"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"
}
What programs do I need? Leave link. Thank you!
try VTS studio,
google it,
best android development suite
Are you trying to decompile a system app from a ROM? If yes then do this:
You need the following:
1. framework-res.apk and twframework-res.apk from the ROM which you took the apk from
2. Probably administrator privilege
You need to do the following:
1. Navigate to Desktop and look for user name folder.
Example: Desktop/Carl/
2. Navigate to user name folder and look for "framework" folder inside "apktool" folder
Example: Desktop/Carl/apktool/framework/
3. Open apktool folder and inside you will see a bunch of frameworks in .apk folder
4. Leave that folder open and take the framework-res.apk and twframework-res.apk from the ROM which you took the apk you're trying to decompile/compile
5. Rename framework-res.apk to: 1.apk and twframework-res.apk to: 2.apk
6. Copy 1.apk and 2.apk to Desktop/<username>/apktool/framework/
Example: Copy 1.apk and 2.apk to Desktop/Carl/apktool/framework/
Once you're done, close and apk tool that you're using and try decompiling/compiling again. If still the problem exist, restart your computer.
Hope this helps.
PS. Sorry for late reply, kinda busy at work.
CarlDeanCatabay said:
Are you trying to decompile a system app from a ROM? If yes then do this:
You need the following:
1. framework-res.apk and twframework-res.apk from the ROM which you took the apk from
2. Probably administrator privilege
You need to do the following:
1. Navigate to Desktop and look for user name folder.
Example: Desktop/Carl/
2. Navigate to user name folder and look for "framework" folder inside "apktool" folder
Example: Desktop/Carl/apktool/framework/
3. Open apktool folder and inside you will see a bunch of frameworks in .apk folder
4. Leave that folder open and take the framework-res.apk and twframework-res.apk from the ROM which you took the apk you're trying to decompile/compile
5. Rename framework-res.apk to: 1.apk and twframework-res.apk to: 2.apk
6. Copy 1.apk and 2.apk to Desktop/<username>/apktool/framework/
Example: Copy 1.apk and 2.apk to Desktop/Carl/apktool/framework/
Once you're done, close and apk tool that you're using and try decompiling/compiling again. If still the problem exist, restart your computer.
Hope this helps.
PS. Sorry for late reply, kinda busy at work.
Click to expand...
Click to collapse
THANKS! Carl, is sucess!
vitorhugo said:
THANKS! Carl, is sucess!
Click to expand...
Click to collapse
Place solved in title k
Sent from my Titan TV S320 using xda premium
How to make a Multilang package for official Motorola’s rom (4.4-):
What do you need? – Skills, patient, knowledge & time.
ONLY UNLOCKED BOOTLOADER & rooted device - if you dont have the firmware.
1. You need the same version of android (4.4.4, 5.0, etc) Nexus, GPE or Android One system apps.
Where do you find this? – In the system dumps – find in XDA’s thread or try Google search. If you dont found, try the factory images and you extract the system.img.
2. Install Android SDK with API 21 for the Lollipop systems & Java SDK.
3. the latest apktool.jar with aapt.exe & apktool.bat. Find it here. After download copy to C:\Windows path.
If you do not have access to C://Windows, you may place the three files anywhere then add that directory to your Environment Variables System PATH variable.
- security step 1: after the copying restart your sytem
- security step 2: install the framework-res.apk ---
a.) Put the apktool.jar & the framework-res.apk (grab from the downloaded system\framework folder) in one folder.
{
"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"
}
b.) Open a command in this folder (like with TotalCommader ’cmd’ command) and type:
apktool if framework-res.apk
and press Enter
- if everything ok you see this:
Framework installed to: /users/…/apktool/framework/1.apk
4. I use BDFReak Advanced Apktool 4.1.0 for the process. Download & extract.
5. Copy the necesseary files to the extracted AdvancedApkTool 2-In folder.
- for example this is the necessary files:
app:
Bluetooth
Calculator
CellBroadcastReceiver
DeskClock
DownloadProviderUi
TelephonyProvider
- framework:
framework-res
- priv-app:
Contacts
ContactsProvider
Dialer
DownloadProvider
Keyguard
Launcher2
Mms
Settings
SettingsProvider
SystemUI
Teleservice
6. Run the Advanced ApkTool.exe – and Install the framework
- after then decompile the apps. The decompiled apk’s folders are in the [3-out] folder.
7. Delete the not necessary folders:
You need only the [res] folders from the decompiled apps and the [raw-] + [values-] folders from this parent folder. Save this folders!
Remains only the [raw- ] and the [values- ] folders.
Example: framework-res.apk\res\raw-HU,
framework-res.apk\res\values-HU
This folders contains the language .xmls & etc for the multilang apps.
After this process you have to save the decompiled apk’s folder to another folder. For example „Nexus 5.0 Extracted apps”.
8. Now you have to copy the system apps from your Motorola device to the AdvancedApkTool [2-In] folder and after decompiled the files.
9. Go to the „Nexus 5.0 Extracted app” and copy the corresponding app’s [res] folders to the Advanced Apktool [3-Out] folder apps.
No overwriting!!! Skipp all the existing folders, xmls!
10. Next step: Recompile the apps.
11. For safety I copy the original .apk's [META-INF] folder + AndroidManifest.xml to the new .apks, overwriting the existing ones.
(The original .apk is te [2-IN] folder, the new .apk is in the [4-OUT] folder. )
Now You are Done!
Next step - Making a flashable package.
I do not take any responsibility. Use at your own risk.
Nice work bro [emoji106]
▪◼ Tapatalk ♦ Moto G ◼▪
Good job
All this work with adding values folders isn't really hard but it takes time and I respect you for been doing this for a long time already.
S0bes said:
Good job
All this work with adding values folders isn't really hard but it takes time and I respect you for been doing this for a long time already.
Click to expand...
Click to collapse
Thank you very much! Previously, I started on the basis of your work. In the last few package with this method only 30 minutes the process, but there are too many other things prevents (another system.img, extract, files from another rom, etc...)
Thereafter I will focus only on the 2013 X.
Hi, are there any changes in your guide for 5.1 android?
machaj25 said:
Hi, are there any changes in your guide for 5.1 android?
Click to expand...
Click to collapse
As soon as I do for a multilang pack for the Moto G 2nd gen 5.1 (not released yet) or the "new" Moto G i refresh the OP.
{
"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"
}
APKTOOL FOR WINDOWS
First and foremost thanks to @iBotPeaches for his dedication to Apktool!
Because I can double-click more accurately than I can type, I made this up to avoid having to use command line and speed up modding the couple of apks that I try to keep up on. Maybe it'll help a few others speed up their process too.
Now, this is a Windows based GUI for Apktool. No command line needed. That said, you should be very familiar with already using Apktool via command line so you know the process that it follows and the corrective measures needed should errors pop up. You need to have the exact same setup as Apktool (Java in your environment path and current Java version AND relevant frameworks installed via apktool!! ). All that this does is provide a simple Windows style menu for the process. You can very easily update apktool.jar as @iBotPeaches updates it. Also, if you would like to add any switch to the decompile or compile command other than the typical (which is what I used) you can just modify the corresponding .bat file located in SupportFiles that APKTool For WIN calls on.
See the attached screenshots in the following post for the easy to follow layout and it's capabilities. It will install frameworks/etc, decompile, compile (with or without original manifest and meta-inf), sign (with testkey or your personal one), and display an apktool log.
As this directly uses apktool.jar, it will have the same quirks/issues such as this current one:
10/18/2016 - for apktool v2.2.1 regarding v2 signed apps - LINK
V4 - As I was posting this, I noticed there was an update to apktool.jar (v2.2.1) which I updated the file to reflect. I modded several apps with the earlier version but only attempted two apps with the updated one (didn't see any issue with either app but I'm still on MM). I haven't looked more in depth at this V2 signed apps issue yet to see if I can modify the signing.bat to account for it (it's 230am). I will update it if there is.
V5 - (1) Updated apktool.jar to 2.2.2 if you haven't already yourself and (2) added java version info in your log file on Decompile routine to help identify a beginners issue on determining whether or not you have java installed in your path
Copy apks to the "APKs_To Decompile" folder.
Copy your framework-res, twframework-res, systemUI as needed to the folder "Frameworks".
Install frameworks.
Running the APKTool For WIN.exe select Install Frameworks
Decompile.
Select Decompile .apk
Choose your apk.
Decompiled app will be in the Decompiled folder.
Compile.
Select Compile
Choose your app to compile.
(One backup will be automatically created if there is an existing one to be safe in the decompiled app's folder)
Choose to copy the original manifest and meta-inf if desired
Compiled apk will be in the Compiled folder
Sign.
Select Sign APK
Choose the apk to sign.
Choose to sign with the testkey or with your personal key (help file is included in the zip for initial setup for using your own key)
Signed apk will be in the Signed folder
APKTool Log
If an Error message is displayed after decompiling or compiling you can check the log.
It's also beneficial to clear the log sometimes.
reserved for future use, faqs, issues
hmmm......after being away for a while i'm checking back to see if anyone had issues with trying to use this....and.......
not a single issue/question/comment with nearly 100 downloads. you guys are GOOD!!! (unless y'all think it's pointless and are being too kind to comment )
in the next few days, i'll use it a bit more in depth with the updated source and see if anything needs tweaking
Great tool !! I like it , this is solve my problems.
thank you so much , please keep it up.
Small update - V5
1. Updated to apktool 2.2.2 in case you haven't already done so yourself.
2. Added your java version info to the log generated when you run a Decompile routine to help beginners identify whether or not java is in the required path