2016-04-02 10 views
0

あなたがアクティビティが必要な場合、またはxmlだけが投稿し、私はそれを投稿します)これらのエラーの原因は誰でも知ることができます。

画像が何か助けてくれたら分かりません...どうもありがとうたくさん:D

04-02 14:00:48.128 1448-1448/? E/AndroidRuntime: FATAL EXCEPTION: main 
              Process: app.alexdickson.com.workout1, PID: 1448 
              java.lang.RuntimeException: Unable to start activity ComponentInfo{app.alexdickson.com.workout1/app.alexdickson.com.workout1.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 
               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2325) 
               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390) 
               at android.app.ActivityThread.access$800(ActivityThread.java:151) 
               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303) 
               at android.os.Handler.dispatchMessage(Handler.java:102) 
               at android.os.Looper.loop(Looper.java:135) 
               at android.app.ActivityThread.main(ActivityThread.java:5257) 
               at java.lang.reflect.Method.invoke(Native Method) 
               at java.lang.reflect.Method.invoke(Method.java:372) 
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903) 
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 
               Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity. 
               at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:310) 
               at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:279) 
               at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:253) 
               at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:109) 
               at app.alexdickson.com.workout1.MainActivity.onCreate(MainActivity.java:18) 
               at android.app.Activity.performCreate(Activity.java:5990) 
               at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1106) 
               at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2278) 
               at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)  
               at android.app.ActivityThread.access$800(ActivityThread.java:151)  
               at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1303)  
               at android.os.Handler.dispatchMessage(Handler.java:102)  
               at android.os.Looper.loop(Looper.java:135)  
               at android.app.ActivityThread.main(ActivityThread.java:5257)  
               at java.lang.reflect.Method.invoke(Native Method)  
               at java.lang.reflect.Method.invoke(Method.java:372)  
               at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)  
               at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698) 

04-02 14:01:28.432 1415-1424/? E/StrictMode: A resource was acquired   at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:71) 
              at android.os.Binder.execTransact(Binder.java:446) 

04-02 14:01:28.441 1415-1424/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:64) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:28.470 1415-1424/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57) 
              at android.os.Binder.execTransact(Binder.java:446) 


04-02 14:01:32.716 1572-1581/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:32.721 1572-1581/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:64) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:32.723 1572-1581/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:71) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:32.929 1588-1597/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:32.932 1588-1597/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:64) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:32.934 1588-1597/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:71) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:33.634 1607-1616/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:33.646 1607-1616/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:64) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:33.648 1607-1616/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:71) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:33.981 1626-1636/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:57) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:33.984 1626-1636/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:64) 
              at android.os.Binder.execTransact(Binder.java:446) 
04-02 14:01:34.001 1626-1636/? E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks. 
             java.lang.Throwable: Explicit termination method 'close' not called 
              at dalvik.system.CloseGuard.open(CloseGuard.java:184) 
              at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:180) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:916) 
              at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:906) 
              at android.app.IBackupAgent$Stub.onTransact(IBackupAgent.java:71) 
              at android.os.Binder.execTransact(Binder.java:446) 

ここでは、エラー

のすべてがここに私のxmlですされています

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

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/logo" 
    android:label="workout" 
    android:theme="@style/MyTheme"> 
    <activity 
     android:name=".MainActivity" 
     android:label="@string/title_activity_main" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN"/> 

      <category android:name="android.intent.category.LAUNCHER"/> 
     </intent-filter> 

    </activity> 
    <activity 
     android:name=".Main2Activity" 
     android:label="@string/title_activity_main2"> 
     <intent-filter> 
     <action android:name="android.intent.action.MAIN"/> 


     <category android:name="android.intent.category.DEFAULT"/> 
     </intent-filter> 

    </activity> 
</application> 
<receiver android:name=".Alarm_Receiver1"/> 
<receiver android:name=".Alarm_Receiver2"/> 

のstyles.xml:

<resources> 

    <style name="MyTheme" parent="@android:style/Theme.Holo.Light"> 
    <item name="android:actionBarStyle">@style/MyActionBar</item>"> 

</style> 

<style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar"> 
    <item name="android:background">@color/colorVerd</item> 
    <item name="android:textColor">@color/colorBlanc</item> 
</style> 

+0

私は、彼らはあなたのコードから来ているかなり確信していたテーマ – Nitesh

+4

を追加します。 – camelCaseCoder

+1

"原因:java.lang.IllegalStateException:このアクティビティでTheme.AppCompatテーマ(または子孫)を使用する必要があります。 – CommonsWare

答えて

-1

は、マニフェストファイルでこれを追加するには、ホロのテーマの代わりにAPPCOMPATテーマを使用する必要が

<application 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme"> 
+0

はすでに@NiteshKumar –

+1

それを得ましたそれは私のアプリですでにそれを持っていたが、感謝@Niteshクマー –

1

(私はそれが対応する一つだと思う、NoActionBarと1もあります)Theme.AppCompat.Light

Theme.Holo.Lightを交換してください。また、このラインはあなたのXMLに誤って設定に見えます。最後に余分な見積もりがあります。マニフェストで

<item name="android:actionBarStyle">@style/MyActionBar</item>"> 
+0

今それは動作しますが、私はアプリとそのロゴの名前で緑色のアクションバーがあった場所を望んでいないテーマを得る、それは白で表示されますアプリの名前ではなく、ロゴなしのアクティビティバー@ cricket_007 –

+0

<スタイル名= "MyActionBar" 親= "Theme.AppCompat.Light"> <項目名= "アンドロイド:バックグラウンド"> @カラー/ colorVerd <項目名= "アンドロイド:の、textColor"> @カラー/ colorBlanc cricket_007 –

+0

@そして、あなたは 'Theme.AppCompat.Light.NoActionBar'を使用するときに何が起こりますか?私はあなたのコードが何をしているのかわからないので、2つのツールバーにロードする可能性が非常に高いです。私はテーマスタイルからいくつかの色が欠けているので、ツールバーでAppCompatActivityを正しく実装する方法に関するチュートリアルを見つけることをお勧めします –

関連する問題