2016-03-31 38 views
-2

style="Widget.AppCompat.Button.Colored"を使用しようとするとエラーが発生します。アンドロイドサポートライブラリバージョン23.2.1を使用しています。 私のxmlファイル:style = "@ style/Widget.AppCompat.Button.Colored"強制終了アプリケーション

<Button 
    android:layout_width = "140dp" 
    android:layout_height = "90dp" 
    android:text = "Camera" 
    android:id = "@+id/cameraButt" 
    android:textAllCaps = "false" 
    android:textColor = "@color/textColorPrimary" 
    android:layout_marginLeft = "5sp" 
    android:layout_marginRight = "5sp" 
    android:layout_marginTop = "4sp" 
    style="@style/Base.Widget.AppCompat.Button.Colored"/> 

そして、それは5.0 ++のバージョンではなく、事前ロリポップで完璧に動作します。

LogCat:

03-30 11:29:10.346 19914-19914/com.emanuel.ocrwithabilities E/AndroidRuntime: FATAL EXCEPTION: main 
                      Process: com.emanuel.ocrwithabilities, PID: 19914 
                      java.lang.RuntimeException: Unable to start activity ComponentInfo{com.emanuel.ocrwithabilities/com.emanuel.ocrwithabilities.MainActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class Button 
                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2200) 
                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249) 
                       at android.app.ActivityThread.access$800(ActivityThread.java:141) 
                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212) 
                       at android.os.Handler.dispatchMessage(Handler.java:102) 
                       at android.os.Looper.loop(Looper.java:136) 
                       at android.app.ActivityThread.main(ActivityThread.java:5052) 
                       at java.lang.reflect.Method.invokeNative(Native Method) 
                       at java.lang.reflect.Method.invoke(Method.java:515) 
                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793) 
                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609) 
                       at dalvik.system.NativeStart.main(Native Method) 
                      Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class Button 
                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716) 
                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:758) 
                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:495) 
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:400) 
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:353) 
                       at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267) 
                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129) 
                       at com.emanuel.ocrwithabilities.MainActivity.onCreate(MainActivity.java:61) 
                       at android.app.Activity.performCreate(Activity.java:5245) 
                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087) 
                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164) 
                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)  
                       at android.app.ActivityThread.access$800(ActivityThread.java:141)  
                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)  
                       at android.os.Handler.dispatchMessage(Handler.java:102)  
                       at android.os.Looper.loop(Looper.java:136)  
                       at android.app.ActivityThread.main(ActivityThread.java:5052)  
                       at java.lang.reflect.Method.invokeNative(Native Method)  
                       at java.lang.reflect.Method.invoke(Method.java:515)  
                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  
                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)  
                       at dalvik.system.NativeStart.main(Native Method)  
                      Caused by: java.lang.NullPointerException 
                       at android.graphics.drawable.LayerDrawable$LayerState.<init>(LayerDrawable.java:671) 
                       at android.graphics.drawable.LayerDrawable.createConstantState(LayerDrawable.java:107) 
                       at android.graphics.drawable.LayerDrawable.mutate(LayerDrawable.java:608) 
                       at android.support.v7.widget.AppCompatDrawableManager.tintDrawable(AppCompatDrawableManager.java:773) 
                       at android.support.v7.widget.AppCompatBackgroundHelper.applySupportBackgroundTint(AppCompatBackgroundHelper.java:118) 
                       at android.support.v7.widget.AppCompatBackgroundHelper.setInternalBackgroundTint(AppCompatBackgroundHelper.java:136) 
                       at android.support.v7.widget.AppCompatBackgroundHelper.loadFromAttributes(AppCompatBackgroundHelper.java:53) 
                       at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:66) 
                       at android.support.v7.widget.AppCompatButton.<init>(AppCompatButton.java:58) 
                       at android.support.v7.app.AppCompatViewInflater.createView(AppCompatViewInflater.java:109) 
                       at android.support.v7.app.AppCompatDelegateImplV7.createView(AppCompatDelegateImplV7.java:963) 
                       at android.support.v7.app.AppCompatDelegateImplV7.onCreateView(AppCompatDelegateImplV7.java:1022) 
                       at android.support.v4.view.LayoutInflaterCompatHC$FactoryWrapperHC.onCreateView(LayoutInflaterCompatHC.java:44) 
                       at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:687) 
                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)  
                       at android.view.LayoutInflater.rInflate(LayoutInflater.java:761)  
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:495)  
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:400)  
                       at android.view.LayoutInflater.inflate(LayoutInflater.java:353)  
                       at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:267)  
                       at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:129)  
                       at com.emanuel.ocrwithabilities.MainActivity.onCreate(MainActivity.java:61)  
                       at android.app.Activity.performCreate(Activity.java:5245)  
                       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1087)  
                       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2164)  
                       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2249)  
                       at android.app.ActivityThread.access$800(ActivityThread.java:141)  
                       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1212)  
                       at android.os.Handler.dispatchMessage(Handler.java:102)  
                       at android.os.Looper.loop(Looper.java:136)  
                       at android.app.ActivityThread.main(ActivityThread.java:5052)  
                       at java.lang.reflect.Method.invokeNative(Native Method)  
                       at java.lang.reflect.Method.invoke(Method.java:515)  
                       at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)  
                       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:609)  
                       at dalvik.system.NativeStart.main(Native Method) 
+0

を教えてくださいあなたのGradleファイル –

+0

java.lang.RuntimeExceptionを表示してください。開始できませんアクティビティComponentInfo {com.emanuel.ocrwithabilities/com.emanuel.ocrwithabilities.MainActivity}:android.view.InflateException:バイナリXMLファイルライン#30:クラスを膨張させるエラーボタン –

答えて

0

あなたのGradle depedenciesにこれを追加し、それが動作するかどうかを確認し、私は

compile 'com.android.support:design:23.2.1' 
+0

ありがとうございます。私はそれほど依存関係を追加していない、そんなにノブです。とにかくお兄さんありがとう。 –

+0

問題ありません。私たちすべてに起こります。 –

関連する問題