2015-06-21 4 views
9

Ciao Sto usando NavigationView ma sto ottenendo l'errore, di seguito è il mio xml, ho già incluso il supporto Android e biblioteca v7

project.properties come io non sto usando in studio Android

target=android-22 
android.library.reference.1=../android-support-v7-appcompat 
android.library.reference.2=../design 


<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:id="@+id/drawer_layout" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true" 
    tools:context="com.toxic.apps.kodi" > 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:orientation="vertical" > 

    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="@color/primary" 
     android:minHeight="?attr/actionBarSize" /> 

    <FrameLayout 
     android:id="@+id/container" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 
</LinearLayout> 

<android.support.design.widget.NavigationView 
    android:id="@+id/navigation" 
    app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    app:headerLayout="@layout/drawer_header" 
    app:itemTextColor="@color/primary" 
    app:menu="@menu/drawer" /> 

</android.support.v4.widget.DrawerLayout> 

e al di sotto è il mio stacktrace

06-21 06:24:12.799: E/AndroidRuntime(4913): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.toxic.apps.kodi/com.toxic.apps.kodi.Activities.MainActivity}: android.view.InflateException: Binary XML file line #30: Error inflating class android.support.design.widget.NavigationView 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2298) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread.access$800(ActivityThread.java:144) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.os.Handler.dispatchMessage(Handler.java:102) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.os.Looper.loop(Looper.java:135) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread.main(ActivityThread.java:5221) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.reflect.Method.invoke(Native Method) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.reflect.Method.invoke(Method.java:372) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) 
06-21 06:24:12.799: E/AndroidRuntime(4913): Caused by: android.view.InflateException: Binary XML file line #30: Error inflating class android.support.design.widget.NavigationView 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.createView(LayoutInflater.java:633) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.rInflate(LayoutInflater.java:806) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.inflate(LayoutInflater.java:504) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.inflate(LayoutInflater.java:414) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.inflate(LayoutInflater.java:365) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.support.v7.app.AppCompatDelegateImplV7.setContentView(AppCompatDelegateImplV7.java:249) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:106) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at com.toxic.apps.kodi.Activities.AbstractBaseActivity.setContentView(AbstractBaseActivity.java:33) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at com.toxic.apps.kodi.Activities.MainActivity.onCreate(MainActivity.java:35) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.Activity.performCreate(Activity.java:5933) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  ... 10 more 
06-21 06:24:12.799: E/AndroidRuntime(4913): Caused by: java.lang.reflect.InvocationTargetException 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.reflect.Constructor.newInstance(Native Method) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.reflect.Constructor.newInstance(Constructor.java:288) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.view.LayoutInflater.createView(LayoutInflater.java:607) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  ... 22 more 
06-21 06:24:12.799: E/AndroidRuntime(4913): Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/design/R$styleable; 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.support.design.internal.ScrimInsetsFrameLayout.<init>(ScrimInsetsFrameLayout.java:54) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.support.design.widget.NavigationView.<init>(NavigationView.java:92) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at android.support.design.widget.NavigationView.<init>(NavigationView.java:88) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  ... 25 more 
06-21 06:24:12.799: E/AndroidRuntime(4913): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.design.R$styleable" on path: DexPathList[[zip file "/data/app/com.toxic.apps.kodi-1/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]] 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  at java.lang.ClassLoader.loadClass(ClassLoader.java:469) 
06-21 06:24:12.799: E/AndroidRuntime(4913):  ... 28 more 
06-21 06:24:12.799: E/AndroidRuntime(4913):  Suppressed: java.lang.ClassNotFoundException: android.support.design.R$styleable 
06-21 06:24:12.799: E/AndroidRuntime(4913):   at java.lang.Class.classForName(Native Method) 
06-21 06:24:12.799: E/AndroidRuntime(4913):   at java.lang.BootClassLoader.findClass(ClassLoader.java:781) 
06-21 06:24:12.799: E/AndroidRuntime(4913):   at java.lang.BootClassLoader.loadClass(ClassLoader.java:841) 
06-21 06:24:12.799: E/AndroidRuntime(4913):   at java.lang.ClassLoader.loadClass(ClassLoader.java:504) 
06-21 06:24:12.799: E/AndroidRuntime(4913):   ... 29 more 
06-21 06:24:12.799: E/AndroidRuntime(4913):  Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available 
+0

Avete creato la voce di menu – Psypher

+0

di postare le dipendenze da file Gradle sembra che ti sei perso qualcosa –

+0

Sì app: menù = "@ menù/cassetto" – ingsaurabh

risposta

8

Ok pinna ho risolto il problema usando il suggerimento di Denis Loh. La chiave per risolvere questo problema è controllare il file R di tutte le librerie incluse, quando questo incidente si verifica design library R non viene generato e quindi non mostrato nella cartella gen del progetto.

Ma Eclipse non si mostrerà problema perché non è generato (Dio sa come eclissi di lavoro)

Quindi, al fine di generare file di R della cartella di disegno

In project.properties di design library obiettivo fissato a 21 o più alto disponibili

Clean v7, il design e la corsa del progetto & godono

+0

Grazie risolto il mio problema :) – Dory

+0

Grazie bro ha funzionato per me. :-) –

+0

Grazie ha funzionato anche per me – Ramesh

1

È possibile importare androidSupportDesign da \ sdk \ extras \ android \ support \ design e spuntare "isLibrary", quindi importare appcombat_v7 (lib) in androidSupportDesign. Finale l'importazione nel progetto e la pulizia di tutto! spero che possa aiutare

Tutte progetto costruito con api> 21

voi!

0

Come risolvere questo problema è necessario eseguire "./gradlew clean", quindi provare a compilare il codice con "./gradlew installDebug".

Suppongo che il problema sia dovuto al vecchio file R che rimane sempre lo stesso e che il compilatore non trova la risorsa correlata a CoordinatorLayout all'interno del vecchio file R.

Possibile questo aiuto.