【问题标题】:Appcelerator/Titanium Android theme - Failed to package applicationAppcelerator/Titanium Android 主题 - 无法打包应用程序
【发布时间】:2014-05-24 06:55:00
【问题描述】:

我尝试通过 Appcelerator 中的链接更改 Android 主题:http://docs.appcelerator.com/titanium/latest/#!/guide/Android_Themes

它给了我以下错误:

[INFO] : 生成路径到项目文件夹\build\android\res\values\theme.xml

[INFO] : 编写未合并的自定义 AndroidManifest.xml

[INFO]:打包申请:

[ERROR] : 打包应用失败:

[ERROR] 应用程序安装程序异常进程终止。进程退出值为 1

尽管我已将我的主题名称设置为 apptheme,但它仍在生成 theme.xml。

以下是一些额外的细节:

应用类型: Android 手机

Titanium SDK: 3.2.3.Beta

平台和版本: Android minSdkVersion="13" targetSdkVersion="14"

钛工作室: 3.2.1.201402041146

设备:三星 SIII

请让我知道我在哪里做错并相应地指导我。

【问题讨论】:

    标签: android titanium android-theme


    【解决方案1】:

    那些写文档的人一定不能测试他们写的东西!

    这个xml来自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>
    

    使用上面 xml 的 aapt ver 19 给了我这个:

    builtin_themes.xml:2:错误:解析 XML 时出错:XML 或文本声明不在实体开头

    所以,解决办法就是把上面的xml改成

    <?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>
    

    请注意,我之前删除了所有前置 xml 标记

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

    【讨论】:

    • 这是我的问题的解决方案。我什至没有收到 xml 错误,只是无法打包应用程序错误。
    【解决方案2】:

    嘿,我能够解决它。

    在 Appcelerator 中自定义 Android 主题的详细步骤:

    1. 转到http://android-holo-colors.com/
    2. 输入主题的名称。此名称将用于引用 您在 Android 清单中的主题。
    3. 为您的主题选择基色。
    4. 如果将 Min SDK Version 设置为
    5. 如果您选择浅色操作栏并且您使用的是版本 3.2.x 及更早版本,您的应用程序必须针对 API 级别 14 构建 (Android 4.0.x)。
    6. 至少将一个小部件控件设置为是,除了 Switch、Switch Jellybean 和 Drawer 必须设置为 No。
    7. 点击网页按钮附近的下载.ZIP按钮 下载您的自定义主题。

    到目前为止,没关系,以下是您必须遵循的重要步骤,以便避免任何构建错误

    1. 在您的根目录下创建一个名为“平台”的文件夹 项目(不在应用程序下)和平台下的子文件夹“android”。
    2. 将解压后的“res”文件夹复制粘贴到android
    3. themes_apptheme.xml 重命名为 mythem.xml
    4. 现在转到 tiapp.xml 并将以下代码粘贴到其中并记下主题 这里的名称将是 MyTheme

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

    【讨论】:

    • 感谢这对我帮助很大。
    猜你喜欢
    • 2017-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多