简体   繁体   English

使用Titanium Studio 3.3.0.GA时Android应用程序崩溃/失败

[英]Android app crashes/fails when using Titanium Studio 3.3.0.GA

I keep getting this error: 我不断收到此错误:

Error: No resource found that matches the given name (at 'theme' with value '@android:style/Theme.AppCompat.Light').

Here's what my tiap.xml looks like: 这是我的tiap.xml的样子:

<android xmlns:android="http://schemas.android.com/apk/res/android">
        <manifest>
            <application android:theme="@android:style/Theme.AppCompat.Light"/>
            <uses-sdk android:minSdkVersion="10" android:targetSdkVersion="19" />
            <supports-screens android:anyDensity="false"/>
        </manifest>
</android>

When ever I change it back to what I had previously, which was "@android:style/Theme.Holo.Light" , the app will crash and I'll get this error: 每当我将其更改回以前的名称时,即"@android:style/Theme.Holo.Light" ,该应用程序将崩溃,并且我将收到此错误:

You need to use a Theme.AppCompat theme (or descendant) with this activity.

Note: I want it to be HoloLight theme. 注意:我希望它成为HoloLight主题。

I figured it out 我想到了

This is incorrect (when using 3.3.0): 这是不正确的(使用3.3.0时):

<application android:theme="@android:style/Theme.AppCompat.Light"/>

This is correct: 这是对的:

<application android:theme="@style/Theme.AppCompat.Light"/>

You don't need the "android" part after the @ symbol. 您无需在@符号后面加上“ android”部分。

The reason why you cannot use the normal Theme.Holo.Light style is because your minimum SDK version is 10, which does not support the Holo Light Theme. 之所以不能使用常规的Theme.Holo.Light样式,是因为您的最低SDK版本为10,该版本不支持Holo Light主题。 As such, the compiler is recommending that you change the style used to one that supports the lower SDK for which you are trying to develop. 因此,编译器建议您将使用的样式更改为支持您尝试为其开发的较低SDK的样式。 An easy way to fix it this is to just not support older Android versions, but this might not be an option for you. 解决此问题的一种简单方法是仅不支持较旧的Android版本,但这可能不是您的选择。

Since you are working with Titanium Studio, I know that it can be a bit difficult to find a fix when everyone else is using Eclipse and Android Studio (they'll probably tell you that you need to add the support library to your build path or build.gradle, which doesn't exactly translate to Titanium Studio) but I believe this fix should work. 由于您使用的是Titanium Studio,所以我知道当其他所有人都使用Eclipse和Android Studio时,找到修复程序可能会有些困难(他们可能会告诉您您需要将支持库添加到构建路径中,或者build.gradle,它不能完全转换为Titanium Studio),但我认为此修复程序应该可以工作。

Essentially, what you are going to do is have devices running newer versions of Android use the Holo Light Theme, whereas older versions will just display the older Light Theme. 本质上,您要做的是让运行较新版本Android的设备使用Holo Light Theme,而较旧版本将仅显示较旧的Light Theme。 I was going to just write up the instructions on how to do that, but there's an old forum post on Appcelerator's website detailing the exact steps. 我本来只是写有关如何执行此操作的说明,但是Appcelerator网站上有一个旧的论坛帖子,详细说明了具体步骤。 Here is a link to the specific answer (it's the one with 8 votes): 这是特定答案的链接(这是8票的答案):

http://developer.appcelerator.com/question/130719/how-do-you-build-your-app-with-holo-theme#answer-250415 http://developer.appcelerator.com/question/130719/how-do-you-build-your-app-with-holo-theme#answer-250415

I believe following those steps should solve the problem. 我相信遵循这些步骤应该可以解决问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Titanium SDK“错误:资产包中未包含&#39;/root/.titanium/mobilesdk/linux/3.3.0.GA/android/titanium.jar&#39;” - titanium sdk “ERROR: Asset package include '/root/.titanium/mobilesdk/linux/3.3.0.GA/android/titanium.jar' not found” 使用Titanium Studio在android中进行应用计费 - in app billing in android using titanium studio 从后台恢复运行时,钛合金APP(Android)崩溃 - Titanium APP (Android) crashes when brought alive from background 使用屏幕上的导航栏后,Android Titan App崩溃 - Android titanium App crashes after using on-screen nav bar 滑动标签页时Titanium Studio应用程序崩溃了吗? - Titanium Studio app crashes while swiping the tabs? 尝试打开文件夹时,使用Android Studio创建的应用程序崩溃 - App created using Android Studio crashes when attempting to open folder Android Studio 应用程序在使用 xml drawable 中的 colorVariant 时在启动时崩溃 - Android Studio app crashes on launch when using ?colorVariant in xml drawable Titanium Android应用程序在更新ScrollableView时崩溃 - Titanium Android app crashes upon updating ScrollableView 滚动查看应用程序崩溃导致Titanium Android问题崩溃 - Titanium Android Issue With Scrollable View App Crashes 要求权限时,应用崩溃/ Android Studio - App Crashes when asking for Permission / Android Studio
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM