[Guide] Create a CM Theme: From environment setup to publishing on Google Play

Search This thread

ANKIT RAWAT

Senior Member
May 25, 2014
523
769
Don't know yet. I only just switched back to CM (from AOSP) now that the theme engine is back. I haven't built a theme for CM12 yet.

I would guess that there shouldn't be any major changes since the theme engine is essentially the same. But, CM is doing some things that don't make much sense to me from a theming perspective. For example, they are using vector drawables instead of PNGs for a lot of things. That makes it easy to change colors, but not to modify the appearance of the icon.This should be relatively easy to fix, but will require extra work. Here's an example where they delete the PNGs and replace with vector drawable xmls:
https://github.com/CyanogenMod/andr...mmit/6ee903388374eed4a518d63cd8b7171bb8df9093

It seems New CM 12 will have vector drawables. Is It benificial for us?
 

CyberScopes

Senior Member
Jun 27, 2012
1,820
1,879
The Underground
Candy5 is currently reverting vector changes and using png for some framework, this is much more ideal for theming. Its quite stupid to use vector images and add theme engine, they both contradict.
 
  • Like
Reactions: upndwn4par

Ask4Android

Member
Dec 28, 2013
29
7
Increase Icons Size

Hi all
anybody know how to increase settings side icons size?
i have added large size icons but no luck, i am creating a theme for CM12.
 

hoppermi

Senior Member
Feb 7, 2011
1,755
1,084
Well, thanks for the reply. But thats not exactly what i'm looking for.
For instance, I want to color the status bar blue in the contacts app.
I know this can be done by making changes in the styles.xml but don't know how!
<item name="android:statusBarColor">#xxxxxxxx</item>. Add to the main app style
 

Arshid Vinod

Senior Member
Dec 15, 2013
83
14
Kannur

Attachments

  • error.JPG
    error.JPG
    13.5 KB · Views: 62
Last edited:

hoppermi

Senior Member
Feb 7, 2011
1,755
1,084
I'm new here! Learned everything from guides like this.
Turn on USB debugging, install Catlog from play store to get easy log and try and install again. You should be able to scroll up the log to find the error. You probably have unsupported attributes in the style. Theme engine will pull what it needs from original apk, so only include the items you are changing, in this case the one I gave you. If it still errors screen shot the error and post it here
 

Arshid Vinod

Senior Member
Dec 15, 2013
83
14
Kannur
Turn on USB debugging, install Catlog from play store to get easy log and try and install again. You should be able to scroll up the log to find the error. You probably have unsupported attributes in the style. Theme engine will pull what it needs from original apk, so only include the items you are changing, in this case the one I gave you. If it still errors screen shot the error and post it here
Here is the screenshot of the logcat!

Edit: I found the error but can't figure out how to fix it.
"No resource found that matches the given name:attr'android:statusbarcolor' "
 

Attachments

  • Screenshot_2015-04-22-07-40-01.png
    Screenshot_2015-04-22-07-40-01.png
    69.8 KB · Views: 126
Last edited:

hoppermi

Senior Member
Feb 7, 2011
1,755
1,084

hoppermi

Senior Member
Feb 7, 2011
1,755
1,084
Here is the screenshot of the logcat!

Edit: I found the error but can't figure out how to fix it.
"No resource found that matches the given name:attr'android:statusbarcolor' "

https://developer.android.com/training/material/theme.html There are some great guides on the android developer website dealing with styles. this is one that shows how to use styles to change status bar.

Also, xml is case sensitive. Make sure you are using capital letters in the right spots
 
Last edited:

larswaechter

Senior Member
Apr 17, 2013
607
961
Frankfurt
larswaechter.dev
Hi guys, I'm getting one problem while compiling my theme.
Everything works fine, until I place the "colors.xml" file in: "\src\main\assets\overlays\android\res\values\styles.xml".
Log is attached because it has to many letters.

Thanks in advance. :)
 

Attachments

  • Log.txt
    41.1 KB · Views: 9

kushpancake

Senior Member
Apr 23, 2010
226
27
Los Angeles
danielsdesign.pro
new icons?!

Does anybody know how I can possibly add an icon to my statusbar? I don't necessarily need it to function... I just want to put a png up there on the far left side. I'm using a nexus 6 running DU 5.1.1 CM TE.

thanks in advance!
 

Suarezian

Senior Member
Jun 18, 2012
578
379
Mumbai
Hi. In the first post for windows installing, in step 2 , it says download Eclipse ADT. But the link beside it is for Android studio. What should I download?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 6
    This thread was created by @EnricoD, and everything except post #6 is his work. I took over this thread when he decided to discontinue support. All credit goes to him. :)
    cm-theme-thread-screenshot.jpg

    *****************************************
    *****************************************



    Build Your First CM11 Theme (or APP!!!)




    - SETTING UP THE BUILD ENVIRONMENT -


    WINDOWS INSTRUCTIONS

    1) Download, Install and set up the Java JDK

    - Download and install the JDK (32 or 64bit)

    http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

    jdk.png


    - Navigate to

    System Properties --> Advanced system settings --> Evironmental variables

    and create a new variable called "JAVA_HOME" where we'll add the JDK path:


    BLBLBLBL.png


    2) Eclipse Setup

    - Download Eclipse ADT and Extract to C:\

    http://developer.android.com/sdk/index.html


    LINUX INSTRUCTIONS

    1) We need the JDK!

    - Open the terminal! roftl

    - Install the OpenJDK running:

    Code:
    sudo apt-get install openjdk-7-jre

    Let's make sure the correct version of Java is running on our PC. To do this just run

    Code:
    java -version


    java.png


    2) SDK setup

    - Download the Standalone SDK Package from here:

    DOWNLOAD: http://dl.google.com/android/android-sdk_r23.0.2-linux.tgz

    - Install the SDK Package

    Let's create a folder in your Home called "development" (You can also call it pincopallino, gino, pippo, Giovanni, Lemonpie, Material, Mathias Duarte... if You want lol)

    Code:
    mkdir ~/development

    Navigate to (your) downloads folder (cd Scaricati for example if You're Italian like Me xD or a custom one... you know!)

    Code:
    cd ~/Downloads

    Extract the SDK package

    Code:
    tar -zxvf android-sdk_r23.0.2-linux.tgz

    move the folder inside development's one. We are already inside the downloads folder! so just run:

    Code:
    mv android-sdk-linux ~/development/

    LINUX & WINDOWS INSTRUCTIONS

    3) Setup ADB/FASTBOOT in Linux and Update Developers Tools in Linux&Windows

    - Linux [You can do this step after Eclipse installation also (like in Windows), it's the same]

    cd to the Android SDK tools folder by running this command:

    Code:
    cd ~/development/android-sdk-linux/tools

    Run the SDK Manager:

    Code:
    ./android

    - Windows

    Open Eclipse ADT and Navigate to/Open

    Window --> Android SDK Manager

    At this point the SDK should come up

    sdk.png


    and .. and... you will need to download all the tools and all the extras files already selected by default.

    1. Be sure to select at least Android 4.4.2 (API 19)!!!!!!!, so select them and install'em all \m/ \m/.

    2. !!!! Avoid Android L (API 20, L preview) & Android 4.4W (API 20) installation. You don't need it for now! (but, if You want to start developing apps for Android L then install them .. your choice! :p)


    Accept all licenses and click OK to all the prompts during installation ;)

    - Setting up ADB&FASTBOOT in Linux

    When it finishes downloading everything you have to run this commands in terminal to return to Your Home folder:

    Code:
    cd

    so let's edit the .bashrc!:

    (You can also use gedit if in Ubuntu, leafpad for Lubuntu, etc etc)

    Code:
    nano .bashrc

    and add your SDK paths at the end of it:

    Code:
    #Android PATHS
    export PATH=$PATH:~/development/android-sdk-linux/tools
    export PATH=$PATH:~/development/android-sdk-linux/platform-tools

    Once done Save or press ctrl+x to exit, S and enter if You're using nano

    Then Run:

    Code:
    source ./.bashrc

    If you followed everything carefully adb and fastboot should work! To check this reopen a terminal and simply type:

    Code:
    fastboot

    The output will look like this:

    fastboot
    usage: fastboot [ <option> ] <command>

    commands:
    update <filename> reflash device from update.zip
    flashall
    ... bla bli blu bla bli bli blu bla bla cit. Jake

    if this method is not working, then install android-tools from ppa:

    Code:
    sudo add-apt-repository ppa:nilarimogard/webupd8

    Code:
    sudo apt-get update

    Code:
    sudo apt-get install android-tools-adb android-tools-fastboot


    Fixing ???????? No permissions errors (click to show)

    To fix this error we need to create a file called android.rules:

    Code:
    cd /tmp/

    and create android.rules by running:

    Code:
    sudo touch android.rules

    Edit the file

    Code:
    sudo nano android.rules

    and copy&paste the following lines:

    Code:
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0e79", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0502", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0b05", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="413c", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0489", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="091e", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0bb4", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="12d1", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="24e3", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2116", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0482", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="17ef", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1004", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="22b8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0409", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2080", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0955", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="2257", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="10a9", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1d4d", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0471", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04da", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="1f53", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04e8", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="04dd", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0fce", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0930", MODE="0666"
    SUBSYSTEM=="usb", ATTRS{idVendor}=="19d2", MODE="0666"

    Save when finished.


    Now we have to copy that file inside /etc/udev/rules.d/ and rename it to 51-android.rules. To do this just run:

    Code:
    sudo cp /tmp/android.rules /etc/udev/rules.d/51-android.rules

    Now you have to set the right permissions to this file, just type:

    Code:
    sudo chmod 644   /etc/udev/rules.d/51-android.rules

    Code:
    sudo chown root. /etc/udev/rules.d/51-android.rules

    and we restart udev and kill adb:

    Code:
    sudo service udev restart

    Code:
    sudo killall adb


    4) Set up Eclipse IDE in Linux

    - Dowload latest Eclipse IDE (I prefer the classical one instead of Google's one)

    http://www.eclipse.org/downloads/?osType=linux&release=undefined

    - Install Eclipse

    cd to downloads folder

    Code:
    cd ~/Downloads

    Extract Eclipse folder by running:

    Code:
    tar -zxvf eclipse-standard-luna-R-linux-gtk.tar.gz

    Move this folder inside /opt folder

    Code:
    sudo mv eclipse /opt

    Run the following command to make eclipse available for all users:

    Code:
    sudo ln -s /opt/eclipse/eclipse /usr/bin/eclipse

    Now, we are going to add a Menu's shortcut, just create this file:

    Code:
    sudo nano /usr/share/applications/eclipse.desktop

    and add the following content:

    [Desktop Entry]
    Version=4.3.2
    Name=Eclipse
    Comment=IDE for all seasons
    Exec=env UBUNTU_MENUPROXY=0 /opt/eclipse/eclipse
    Icon=/opt/eclipse/icon.xpm
    Terminal=false
    Type=Application
    Categories=Utility;Application;Development;IDE

    ctrl+x then Y to save.


    - Now We can run Eclipse and choose the location of our workspace (we can leave the default one and tickmark «use this as the default and do not ask again»)

    NOTE: You can also use directly Eclipse ADT + sdk instead of classical Eclipse IDE.

    http://developer.android.com/sdk/index.html

    5) ADT Plugin setup

    FOLLOW THIS:

    http://developer.android.com/sdk/installing/installing-adt.html


    6) Android Studio

    http://developer.android.com/sdk/installing/studio.html

    - Linux

    Code:
    cd ~/Downloads

    Code:
    tar -zxvf android-studio-bundle-135.1245622-linux.tgz
    mv android-studio ~/development/

    To run it you just need to navigate to its bin folder and type

    Code:
    ./studio.sh

    also, check @blinqipa 's thread because I don't use Android Studio xd

    http://xdaforums.com/showthread.php?t=2780923


    7) APKTOOL (in case You need it)

    WINDOWS INSTRUCTIONS

    - Download Apktool from here and extract where You want:

    http://xdaforums.com/showpost.php?p=50205159&postcount=90

    LINUX INSTRUCTIONS

    - Download it running this in a terminal:

    Code:
    wget https://www.dropbox.com/s/6s9bxszxjl7wclz/apktool.tar.gz

    - Extract

    Code:
    tar -zxvf apktool.tar.gz

    - cd to apktool folder

    Code:
    cd apktool

    - Root permissions

    Code:
    sudo chown -R [COLOR="red"][B]yourusername[/B][/COLOR] aapt apktool apktool.jar

    enricod[/COLOR @EnricoD-Aspire-5920G:~/Scrivania/apktool$

    - Make them exec

    Code:
    sudo chmod +x aapt apktool apktool.jar

    - Move to usr/local/bin

    Code:
    sudo cp aapt apktool apktool.jar /usr/local/bin

    To see if it works just run

    Code:
    apktool

    in a terminal. The output will look like this:

    enricod@enricod-Aspire-5920G:~/Scrivania/apktool$ apktool
    Apktool v1.5.2 - a tool for reengineering Android apk files
    Copyright 2010 Ryszard Wiśniewski <brut.alll@gmail.com>
    with smali v1.4.1, and baksmali v1.4.1
    Updated by @iBotPeaches <connor.tumbleson@gmail.com>
    Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
    ... bla bli blu bla bli bli blu bla bla cit. Jake



    - You can now delete the package and the extracted folder


    - Little guide on how to use apktool

    http://xdaforums.com/showpost.php?p=50181967&postcount=57
    6
    Import CM11 Template in Eclipse

    IMPORT THE CYANOGENMOD TEMPLATE


    1) FIRST! We open a logcat console! xD

    In Eclipse navigate to

    Window --> Show View --> Other... --> Android --> Logcat --> OK!

    Senza_nome.png


    2) Download the Official Template from here and extract it where You want:

    https://github.com/CyanogenMod/android_packages_themes_Template

    image.png


    3) Open Eclipse

    File--> Import --> Android --> Existing Android Code Into Workspace

    1import.png


    and select the root folder where the project is located, change its name, tickmark "Copy projects into workspace" and click Finish

    2import.png



    DONE!

    4) The first thing we'll do is to change the package name in AndroidManifest.xml.

    2014_07_11_215706_1280x800_scrot.png



    - We're going to edit and add the following lines:

    Code:
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="[COLOR="Red"][B]com.your.theme.template[/B][/COLOR]">
    <!-- Add build version number, #=number -->
    [COLOR="SeaGreen"]     [B]android:versionCode="#"
         android:versionName="#" >[/B][/COLOR]
    <!-- To avoid compatibility & permissions problems -->
        [COLOR="SeaGreen"][B]<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="19" />[/B][/COLOR]
    <!-- Add this and your theme won't ask for strange permissions -->
        [COLOR="SeaGreen"][B]<uses-permission android:name="android.permission.SET_WALLPAPER" />[/B][/COLOR]
    
        <uses-feature android:required="true" android:name="org.cyanogenmod.theme" />
    
        <application android:hasCode="false" android:icon="@drawable/ic_launcher" android:label="[COLOR="red"][B]Theme name[/B][/COLOR]">
        </application>
    
        <meta-data android:name="org.cyanogenmod.theme.name" android:value="[B][COLOR="red"]Theme name[/COLOR][/B]"/>
        <meta-data android:name="org.cyanogenmod.theme.author" android:value="[COLOR="red"][B]Your name[/B][/COLOR]" />
    
    </manifest>

    NOTE: Do not add comments (<!-- blablabla -->)


    2014_07_11_215903_1280x800_scrot.png



    - Navigate to

    Project and

    1. Clean (build only the selected projects) (disable also "build automatically")

    2. Build project

    As Youu can see gen files got updated :)

    2014_07_11_220046_1280x800_scrot.png



    5) Run and try the theme!

    Connect Your device and grant ADB access, then Select Your project and just press ctrl+f11or or Navigate to Run -->Run and select Your device

    Senza_nome2.png


    6) Export a Signed APK for the Google Play Store

    - Right-Click on Your project and navigate to

    Android Tools --> Export a signed application package

    image.png


    We select Create new keystore, save keystore where You want and add a password. When finished click next.

    - In next screen

    image.png


    We add:

    Alias
    password
    validity (from 1 to 1000 years)
    First and lastname

    - Now choose a destination and a name for Your signed apk.

    2014_07_11_221013_1280x800_scrot.png



    and click Finish

    image.png




    7) Oh s****! an Error during compilation process !!!!

    image.png


    1 - Open the LOGCAT console!

    image.png


    and search for the error!!

    image.png


    Fix it!!!!

    2014_07_12_133618_1280x800_scrot.png






    F.A.Q.:

    1 - " OMG that desktop wallpapers are awesome, can You share?? pls pls pls pls :fingers-crossed: "

    Sure!

    https://dribbble.com/shots/1355879-Meteor-Wallpaper

    http://images8.alphacoders.com/393/393340.jpg

    2 - "d***q!, dat theme/icons are too awesome :eek:"

    I'm simply running Lubuntu + Numix candies:

    sudo add-apt-repository ppa:numix/ppa

    sudo apt-get update

    sudo apt-get install numix-gtk-theme numix-icon-theme-circle

    and my personal menu icon

    https://www.dropbox.com/s/u0lo7zqn7f95q3o/Senza nome.png


    Credits (listed randomly):

    - @hoppermi (support)
    - @CyanogenMod
    - @blinqipa for Android studio thread
    - @ivn888
    - Cristian Giordano for Theme Debugger App
    - @google (Eclipse ADT, SDK)
    - @eclipse (Eclipse IDE)
    - @iBotPeaches for apktool
    - @iamareebjamal
    - Ivan Botty





    NOTE:

    Please, don't use this guide to develop another Android L Theme! :silly::silly::silly:


    materialdesignenri.gif
    5
    I will not use XDA account anymore so I'm going to discontinue my tuts/support

    but I'll release source code of chocoui, jellyrevenge with themed keyboards next hours, You can use as base to understand how You can theme it

    Wow, i'm sure you have your reasons but me and i'm sure a lot of other people will be sad to see you go :(

    Can't even tell you the amount of times iv'e used one of your guides with a mod or something or just looking for general help.

    I wish you all the best :good:
    4
    I put my DarkerGreen theme on github, if anyone wants a light theme template https://github.com/Grasshopper239/DarkerGreen
    4
    Hi Everyone,

    Finally done :)

    Decompiled Resources for most densities
    I case you don't know what this is or what I do here, these are decompiled resources for all the themers out there. So say you have limited internet (Only 30-40mb per file) or just don't have the time to trawl though dozens of apks, this is for you. I have decompiled 'core' apps for PA, CM and AOKP.

    Core Apps are:

    System-App:
    DeskClock
    Email

    System-Priv App:
    Contacts
    Framework
    Keyguard
    Settings
    SystemUI

    Things included in Phone devices:
    IncallUI
    Dialer
    MMS

    If you want other apps, let me know and I will add them in a separate package :good:

    I have done it for the following densities, I tried to be as broad as possible but if you want more densities/devices added, let me know :good:

    XXHDPI- Hammerhead/Nexus 5
    XHDPI- Mako/naxus 4
    HDPI- I9100/Galaxy S2
    Tablet-
    Flo/Nexus 7 2013
    Grouper/Nexus 7 2012


    Download:
    Now how I have structured it is one main folder that contains all the sub device folders with all the files you need inside compressed zips (decompiled of course :) ):

    http://www.androidfilehost.com/?w=files&flid=17577

    Updating all files as this is being typed................


    Enjoy and if I made any errors, let me know ASAP
    If you want anything added, let me know.

    Press the thanks button if you like my work :good: