java.lang.IllegalStateException: Sie brauchen, um ein Thema zu verwenden.AppCompat Thema (oder Nachkomme) mit dieser Tätigkeit. Titan
Ich bin erstellen einer benutzerdefinierten Thema für meine Titan-Anwendung mit diesem Thema generator. Aber wenn ich meine Anwendung es zu Abstürzen und mein log sagt, dass ich brauche appCompact
auch wenn ich das Thema für sdk - > sdk 11.
Und mein targeting Android-version ist API-19 und die min-SDK-version ist API14, so Frage ich mich, warum ich brauche appCompact
.
Dies ist, was mein log sagt:
[ERROR] : TiApplication: (main) [512,512] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start activity ComponentInfo{a.s/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.; Titanium 3.4.0,2014/09/25 16:42,b54c467
[ERROR] : TiApplication: java.lang.RuntimeException: Unable to start activity ComponentInfo{a.s/org.appcelerator.titanium.TiActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2195)
[ERROR] : TiApplication: at android.app.ActivityThread.handleLaunchActivity(Activ
[ERROR] : TiApplication: at android.app.ActivityThread.access$800(ActivityThread.java:135)
[ERROR] : TiApplication: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1196)
[ERROR] : TiApplication: at android.os.Handler.dispatchMessage(Handler.java:102)
[ERROR] : TiApplication: at android.os.Looper.loop(Looper.java:136)
[ERROR] : TiApplication: at android.app.ActivityThread.main(ActivityThread.java:5017)
[ERROR] : TiApplication: at java.lang.reflect.Method.invokeNative(Native Method)
[ERROR] : TiApplication: at java.lang.reflect.Method.invoke(Method.java:515)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
[ERROR] : TiApplication: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
[ERROR] : TiApplication: at dalvik.system.NativeStart.main(Native Method)
[ERROR] : TiApplication: Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivityDelegate.onCreate(ActionBarActivityDelegate.java:108)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivityDelegateICS.onCreate(ActionBarActivityDelegateICS.java:57)
[ERROR] : TiApplication: at android.support.v7.app.ActionBarActivity.onCreate(ActionBarActivity.java:98)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiBaseActivity.onCreate(TiBaseActivity.java:516)
[ERROR] : TiApplication: at org.appcelerator.titanium.TiActivity.onCreate(TiActivity.java:18)
[ERROR] : TiApplication: at android.app.Activity.performCreate(Activity.java:5231)
[ERROR] : TiApplication: at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)
[ERROR] : TiApplication: at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2159)
[ERROR] : TiApplication: ... 11 more
können Sie Ihre
<android xmlns:android="schemas.android.com/apk/res/android"> <tool-api-Ebene>14</tool-api-Ebene> <manifest> <application android:screenOrientation="portrait" android:theme="@style/Licht"/> <uses-sdk android:minSdkVersion="14"/> <uses-sdk android:targetSdkVersion="19"/> </manifest> </android>
appname/Plattform/android/res/Werte
was ist die
die
tiapp.xml
und den Pfad, wo Sie Ihr Thema generiert.<android xmlns:android="schemas.android.com/apk/res/android"> <tool-api-Ebene>14</tool-api-Ebene> <manifest> <application android:screenOrientation="portrait" android:theme="@style/Licht"/> <uses-sdk android:minSdkVersion="14"/> <uses-sdk android:targetSdkVersion="19"/> </manifest> </android>
appname/Plattform/android/res/Werte
was ist die
parent
Wert in Ihrem @style/Light
( wäre bei appname/platform/android/res/values/styles.xml )die
parent
im Thema Licht sollte wie <style name="Light" parent="@style/Theme.AppCompat.Light">
InformationsquelleAutor Antwan | 2014-11-01
Du musst angemeldet sein, um einen Kommentar abzugeben.
Verwenden Sie eine
ActionBarActivity
, die eine AppCompat Thema. Ich bin mir nicht sicher, wie würden Sie tun dies mit Titan, aber Sie würden müssen entweder wechseln Sie zu einem AppCompat Thema oder verwenden Sie einen regelmäßigenActivity
(was kein problem sein sollte, wenn Sie targeting-11 oder höher).AppCompatActivity
Aktivität ..die Actionbar verschwunden ist ..haben Sie Ihre Themen erklären, dass die
ActionBar
sollte nicht gezeigt werden?Das ist auch meine Frage bro ..Können Sie diese beantworten ..stackoverflow.com/questions/32437690/...
InformationsquelleAutor Nathan Walters
ok bitte versuchen Sie dieses,
Dieses Attribut hinzufügen, um Ihre Aktivitäten
InformationsquelleAutor sam
Ich weiß, es ist sehr nur Frage, sondern Sie sollten auch übergeordnete Thema in Ihrem Stil.
InformationsquelleAutor NovusMobile
Ändern Sie einfach die ActionBarActivity zu Aktivität oder FragmentActivity
InformationsquelleAutor Vipin Yadav
schreiben Sie den code in style-v11 Ordner
und Stilen-v14 Ordner
Dank seiner Hilfe mir
InformationsquelleAutor velraj
Es ist ein bisschen peinlich, zuzugeben, wie ich erlebt habe, diesen Fehler, aber in der Hoffnung zu sparen, jemanden eine Stunde oder Haare ziehen - für mich war es eine verirrte ">", die ich fälschlicherweise kopiert und in meine
AndroidManifest
:Zu leicht zu verpassen, wenn Sie ein sehr großes manifest - der compiler nicht meckern.
InformationsquelleAutor Amir Uval
Löschen Sie alle Stile in der Bibliothek-Projekt.
Geben Sie Stil-Ordner nur im Haupt-Projekt nicht im Bibliothek-Projekt.
Bei mir hat es geklappt 🙂
InformationsquelleAutor Jasmine John