sUndeep
sUndeep

Reputation: 360

Appcelerator/Titanium Android theme - Failed to package application

I tried to change theme for Android by following the link in Appcelerator: http://docs.appcelerator.com/titanium/latest/#!/guide/Android_Themes

It’s giving me below error:

[INFO] : Generating path-to-projectfolder\build\android\res\values\theme.xml

[INFO] : Writing unmerged custom AndroidManifest.xml

[INFO] : Packaging application:

[ERROR] : Failed to package application:

[ERROR] Application Installer abnormal process termination. Process exit value was 1

Please mark although I have set my theme name as apptheme, it's still generating theme.xml.

Below are some addtionald details:

Application type: Mobile Android

Titanium SDK: 3.2.3.Beta

Platform & version: Android minSdkVersion="13" targetSdkVersion="14"

Titanium Studio: 3.2.1.201402041146

Device: Samsung SIII

Please let me know where I am doing the mistake and guide me accordingly.

Upvotes: 1

Views: 2925

Answers (2)

ardhitama
ardhitama

Reputation: 1992

Those guys that wrote the docs must be not test what they've written!

This xml come from http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Themes

<!-- Works for Titanium SDK 3.2.x and earlier when built against Android 4.0x/API Level 14 -->
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Available for Android 4.0.x/API Level 14 and later -->
    <style name="LightDarkBar" parent="@android:style/Theme.Holo.Light.DarkActionBar"/> 
    <!-- Available for Android 3.0.x/API Level 11 and later -->
    <style name="Light" parent="@android:style/Theme.Holo.Light"/>
    <style name="Dark" parent="@android:style/Theme.Holo"/>
    <!-- Available for all Android versions -->
    <style name="OldLight" parent="@android:style/Theme.Light"/>
    <style name="OldDark" parent="@android:style/Theme.Black"/>
</resources>

using aapt ver 19 above xml gave me this:

builtin_themes.xml:2: error: Error parsing XML: XML or text declaration not at start of entity

So, the solution is change above xml to

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Available for Android 4.0.x/API Level 14 and later -->
    <style name="LightDarkBar" parent="@android:style/Theme.Holo.Light.DarkActionBar"/> 
    <!-- Available for Android 3.0.x/API Level 11 and later -->
    <style name="Light" parent="@android:style/Theme.Holo.Light"/>
    <style name="Dark" parent="@android:style/Theme.Holo"/>
    <!-- Available for all Android versions -->
    <style name="OldLight" parent="@android:style/Theme.Light"/>
    <style name="OldDark" parent="@android:style/Theme.Black"/>
</resources>

Please note that I removed any pre-trailing xml tags before

<?xml version="1.0" encoding="utf-8"?>

Upvotes: 2

sUndeep
sUndeep

Reputation: 360

Hey I am able to resolve it.

Details steps for customizing Android theme in Appcelerator:

  1. Go to http://android-holo-colors.com/
  2. Enter a name for your theme. This name will be used to reference your theme in the Android manifest.
  3. Pick a base color for your theme.
  4. If you set Min SDK Version to < 11, a. For Release 3.3.x and later, make sure Compatibility is set to APPCOMPAT. b. For Release 3.2.x and earlier, make sure Compatibility is set to NONE.
  5. If you select LIGHT DARK ACTIONBAR and you are using Release 3.2.x and earlier, your application must be built against API level 14 (Android 4.0.x).
  6. Set at least one widget control to Yes, except Switch, Switch Jellybean and Drawer must be set to No.
  7. Click Download .ZIP button near the button of the web page to download your custom theme.

Upto this it's alright and below are the important steps you must follow so as to avoid any build error:

  1. Create a folder named 'platform' under the root directory of your project (not under app) and a sub-folder 'android' under platform.
  2. Copy & Paste the unzipped 'res' folder to android
  3. Rename the themes_apptheme.xml to mythem.xml
  4. Now goto tiapp.xml and paste the below code inside and note down that the theme name will be MyTheme here:

    <manifest> <!-- Replace AppThemeName with the name of your theme --> <application android:theme="@style/MyTheme"/> <uses-sdk android:minSdkVersion="13" android:targetSdkVersion="14"/> </manifest>

Upvotes: 1

Related Questions