1

除了只有三星設備(Android 4.2和4.4 kitkat),Galaxygrand,核心總理等其他設備的應用程序工作正常錯誤膨脹類android.support.design.widget.NavigationView,獲取三星設備上的錯誤只,

我正在使用設計支持庫中的Appcompact NavigationView。

dependencies { 
    compile 'com.flurry.android:analytics:6.2.0' 

    compile project.COMPILE_APPCOMPACT_VERSION 
    // Support Libraries 
    compile 'com.android.support:cardview-v7:23.0.1' 
    compile 'com.android.support:design:23.0.1' 
// compile 'com.android.support:gridlayout-v7:23.0.1' 
// compile 'com.android.support:leanback-v17:23.0.1' 
    compile 'com.android.support:mediarouter-v7:23.0.1' 
    compile 'com.android.support:palette-v7:23.0.1' 
    compile 'com.android.support:recyclerview-v7:23.0.1' 
    compile 'com.android.support:support-annotations:23.0.1' 
// compile 'com.android.support:support-v13:23.0.1' 
    compile 'com.android.support:support-v4:23.0.1' 



<android.support.design.widget.NavigationView 
     android:id="@+id/main_nav_view" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     android:fitsSystemWindows="true" 
     app:headerLayout="@layout/nav_header_main" 
     app:itemTextColor="@drawable/drawer_item" 
     app:menu="@menu/activity_main_drawer" 
     app:theme="@style/NavigationDrawerStyle" /> 

誤差

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.manish.indiancallerdetail/com.manish.indiancallerdetail.ui.MainActivity}: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2404) 
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2464) 
    at android.app.ActivityThread.access$900(ActivityThread.java:172) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1308) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:146) 
    at android.app.ActivityThread.main(ActivityThread.java:5653) 
    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:1291) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107) 
    at dalvik.system.NativeStart.main(Native Method) 
Caused by: android.view.InflateException: Binary XML file line #16: Error inflating class android.support.design.widget.NavigationView 
    at android.view.LayoutInflater.createView(LayoutInflater.java:626) 
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:702) 
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:761) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:498) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:398) 
    at android.view.LayoutInflater.inflate(LayoutInflater.java:354) 
    at android.support.v7.app.AppCompatDelegateImplV7.setContentView(SourceFile:255) 
    at android.support.v7.app.AppCompatActivity.setContentView(SourceFile:109) 
    at com.manish.indiancallerdetail.ui.common.BaseAppCompActivity.setContentView(SourceFile:85) 
    at com.manish.indiancallerdetail.ui.MainActivity.onCreate(SourceFile:85) 
    at android.app.Activity.performCreate(Activity.java:5541) 
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1093) 
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2368) 
    ... 11 more 
Caused by: java.lang.reflect.InvocationTargetException 
    at java.lang.reflect.Constructor.constructNative(Native Method) 
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423) 
    at android.view.LayoutInflater.createView(LayoutInflater.java:600) 
    ... 23 more 
Caused by: android.content.res.Resources$NotFoundException: Resource is not a ColorStateList (color or path): TypedValue{t=0x5/d=0x1001 a=2 r=0x105002b} 
    at android.content.res.Resources.loadColorStateList(Resources.java:3532) 
    at android.content.res.TypedArray.getColorStateList(TypedArray.java:343) 
    at android.support.design.widget.NavigationView.<init>(SourceFile:119) 
    at android.support.design.widget.NavigationView.<init>(SourceFile:92) 
    ... 26 more 

```

+0

我相信它是'Appcompat'(不是「契約」),以防萬一。 – DarkCygnus

+0

@Manish - 你有沒有得到任何解決方案? – Manish

回答

0

您應該更新您的支持庫。

最新的com.android.support版本是23.4.0,參見here

compile 'com.android.support:cardview-v7:23.4.0' 
    compile 'com.android.support:design:23.4.0' 
// compile 'com.android.support:gridlayout-v7:23.4.0' 
// compile 'com.android.support:leanback-v17:23.4.0' 
    compile 'com.android.support:mediarouter-v7:23.4.0' 
    compile 'com.android.support:palette-v7:23.4.0' 
    compile 'com.android.support:recyclerview-v7:23.4.0' 
    compile 'com.android.support:support-annotations:23.4.0' 
// compile 'com.android.support:support-v13:23.4.0' 
    compile 'com.android.support:support-v4:23.4.0' 
+0

不工作的傢伙...... :( –

相關問題