[LG G5 Themes, Apps, and Mods] strikerman10:
Introduction

This is going to be a long post! A few weeks ago I started thinking about making my own themes for my LG G5. I had installed some custom roms previously and used substratum a bit but I have always ended up going back to xpirt's Fulmics rom, which doesn't allow this. I started to think how I could do this and have today got to the first stage of being able to change the colours of my phone to precisely what I want, not only for the settings but in some of the stock apps. I thought I would share this with the community and provide some step by step instructions so you can try it yourself. This should work on LG G6, V10, V20 & V30 if you use an app made for these phones but I have no way of testing this so don't hold me to it. This has taken me about 5 full days to work this out and there is still more that I need to do.

I am not in anyway a developer or coder and have very little knowledge of Java so if anything goes wrong here it is likely that I will not be able to help you. I absolutely am a noob at this and do this only for a hobby, using just my common sense and our friend Google to overcome the problems I have come across. Saying that, I will try to offer assistance if I can.

I managed to make my theme from reverse engineering a free LG theme app that was readily available. If you do this method though please consider getting approval from the app developer first. There is a template on here posted by Raafat here. While this was helpful it was only basic and I could not work out exactly what to do. Reverse engineering an app was much easier. Here is how I did it with step by step instructions:

******DISCLAIMER******

I am in not responsible for what you do to your phone. If you decide to try and theme your phone make a backup first or be prepared to do a full reset if anything goes wrong. You do this at your own risk.

1.	Programmes

The programmes/software needed for theming are:

•	Notepad++

•	Apktool

•	Android Studio (I used version 2.3 as I was getting an error on re-signing with 3.0)

2.	Installing Frameworks Using Apktool:

•	Firstly, delete the files in your local temp directory. To do this open ‘Search’ and type in %temp% and delete all files in this folder. You may not be able to delete some of the files. This does not matter

•	Next, extract the framework files from your rom/custom rom. For Fulmics 5.5 this was:

Frameworks-res.apk

lge-res.apk

•	At a guess I would say that any rom will have these files named exactly as they are above, but I am not sure if these have been altered by xpirt for his rom so you may not be able to use them across other roms.

•	Open a command prompt and navigate to the folder where the framework files are kept. This is easiest in a folder called C:/apktool so create a folder in your C:/ drive and place them there. You can of course name the folder or locate it where you want though.

•	Use apktool to install the frameworks using this command in the command prompt in C:\apktool

apktool if framework-res.apk

apktool if lge-res.apk

•	Once this is done you should find the following files Installed here: C:\Users\[your username]\AppData\Local\apktool\Framework

1.apk

2.apk

•	If, like me, you get an error with apktool that says it cannot write to C:\Users\[your username]\AppData\Local\apktool\Framework and instead has placed them in the temp folder then go into the Local folder using the pathway above and create a folder called 'apktool' and then a subfolder called 'framework'. Try the commands again and it should then work.

•	You should also find the following files in the C:\apktool folder (if that is the folder you are using). If they are not here you may have to copy and paste them from the apktool github download.

apktool.jar

apktool.bat

•	If you have found these files then you are set to go with decoding the theme/app you have chosen as a basis to amend.

3.	Decoding APKs Using Apktool

•	Download the apk/app you want to use. I used Backup and Restore app from Play to get the app I wanted to use onto my PC. Once you have this on your PC place the main APK/app in the same folder as the apktool.bat and the apktool.jar (for me this this was C:\apktool)

•	Point the command prompt at this place and type the following:

apktool d [app name]

•	A folder with the name of the app you just decoded will appear in the directory that you use (in this case C:\apktool)

•	In this folder you should find another folder called assets. There may be more sub APKs here in subfolders. This subfolder will likely be assets>overlays

•	All the sub APKs in here will have to be decoded otherwise you will have different signing keys and the app, once compiled again, will not work. Decode all the sub APKs in this same folder. You will have to copy the following files to the folder you are decoding the sub APKs in. These are:

apktool.jar

apktool.bat

•	Decode every sub apk using the command apktool d [sub_apkname]

•	You should now have the same number of folders in the drive as the number of sub APKs, if you decoded them all.

4. Changing the Colours and other Themes from the Decoded APKs Using Notepad++

•	Many theme APKs will have internal APKs, such as common, settings, phone, systemui, calendar etc, etc. This is what I have worked out so far:

Common: Changes the switches, brightness bar and the text headings in settings, changes swipe left panels in apps such as gallery, changes background, message icon & phone icon colour in contact/phone app, statusbar background, separating lines in settings (some themes do not have these), background bar of setting title (i.e. wireless network, device etc), settings text colour, secondary text (i.e. the text you see under Wifi and Bluetooth which shows you what you are connected to), the headings in apps such as clock where it shows 'Alarm' 'World Clock' 'Timer' etc

System UI: Changes the quick settings tiles & text and the non-heading text in settings

•	To change the colour of these you have to amend the colors.xml located in one of the folders in the assets>overlays and then the folder of the overlay you want to change. I used Notepad++ to do this. Navigate to 'res' folder and then usually something like 'values-xxxhdpi-v4'. There is sometimes more than one color.xml file so you may need to look in more than one folder and amend all the color.xml files. The colours are at the end of the lines of text and will be standard Android colour coding, such as ffffffff (white) or 00000000 (black) or any other colours.

5. Building APKs & Signing with Android Studio

•	If you are building the sub APKs from an app (these are the ones inside an APK such as common, systemui, phone etc) I found it best to use a different folder. For this I used C:\apktool builder

•	Copy and paste the folder from the decoded APK (e.g. the [appname].LGE.common folder) that is in the asset>overlays folder to the apktool builder folder above

•	Once you have made the colour amendments it is time to build the amended themes. To do this you will need Android Studio

•	Open the splash screen of Android Studio and instead of the 'Open' command use the 'Import Project' command and navigate to the folder you want to import

•	When opening Android Studio you have to configure the frameworks otherwise you will not be able to sign the app. This warning should come up automatically. THIS MUST BE DONE FOR IT TO WORK

•	Navigate and find your APK in apktool builder and import it. If you do this more than once you will be prompted to overwrite the settings a few times.

•	Go to ‘Build’ along the top and choose ‘Generate Signed APK’. If this is the first time it will ask for the Key Store Path. You will need to choose ‘Create New’. Select a place to store this key (I chose C:\apktool Builder) and input the passwords and the other data in the boxes. You must put a two-digit country code in the last box, for example US, UK etc). For ease I kept most of these very simple. For example, password was 'asdfgh'

•	Once this has been completed and if there are no errors (warnings are ok) then it will generate a signed sub APK and save it to the location you are in (in this case C:\apktool builder). Copy and paste that sub APK over the one in the C:\apktool folder where the original sub APK was kept.

•	Once you have done this then you need to sign the main app APK. Do the same as above and build in Android Studio. If there are no errors it will save it to your directory (in my case C:\apktool\[app name].

•	Copy and paste this APK into your phone, apply the theme and it should work.

Everytime you amend a sub apk you will have to re-sign it through Android studio and then re-sign the main app apk. Once you get the hang of it though it is fairly straight forward.

6. Other Things

Nothing else in the app will change at this point. The name, wallpaper jpegs, screenshots and icons will all be the same. I am working on this at the moment but they don't actually need changing that much. The difficult thing for me is how to change the 9.png icon files and still get them to work. Once I have worked this out I will be able to finish it off.

7. Screenshots

Attached are some screenshots of how my phone now looks. I have made a few different apk's with different colours so I can now change this daily if I want a change (see post 2 for updated screenshots).

8. Thanks/Credits

@xpirt - Made it easy to get the framework files I needed for apktool and for a great custom rom!

@Raafat - for giving me the idea and the initial information

@iBotPeaches - for developing apktool.

.