Xamarin Android支持v7 Cardview示例失败

时间:2016-05-30 10:57:44

标签: android xamarin xamarin.android android-support-library android-cardview

当我运行Xamarin Android Support v7 Cardview SAMPLE项目时,我收到以下错误:"错误膨胀类android.support.v7.widget.CardView"。我怎样才能让它发挥作用?在堆栈跟踪下面找到。

Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.CardView ---> Java.Lang.Reflect.InvocationTargetException:  ---> Java.Lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/cardview/R$styleable; ---> Java.Lang.ClassNotFoundException: Didn't find class "android.support.v7.cardview.R$styleable" on path: DexPathList[[zip file "/data/app/com.xamarin.supportv7cardview.sample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.supportv7cardview.sample-1/lib/arm, /vendor/lib, /system/lib]]
  at --- End of managed exception stack trace ---
  at java.lang.ClassNotFoundException: Didn't find class "android.support.v7.cardview.R$styleable" on path: DexPathList[[zip file "/data/app/com.xamarin.supportv7cardview.sample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.supportv7cardview.sample-1/lib/arm, /vendor/lib, /system/lib]]
  at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  at at android.support.v7.widget.CardView.initialize(CardView.java:203)
  at at android.support.v7.widget.CardView.<init>(CardView.java:101)
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:607)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
  at at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
  at at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
  at at android.app.Activity.setContentView(Activity.java:2153)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.n_onCreate(Native Method)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Activity.performCreate(Activity.java:5976)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
  at at android.app.ActivityThread.access$800(ActivityThread.java:144)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
  at at android.os.Handler.dispatchMessage(Handler.java:102)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5221)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  at Suppressed: java.lang.ClassNotFoundException: android.support.v7.cardview.R$styleable
  at at java.lang.Class.classForName(Native Method)
  at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  at ... 28 more
  at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  --- End of inner exception stack trace ---
  at --- End of managed exception stack trace ---
  at java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/cardview/R$styleable;
  at at android.support.v7.widget.CardView.initialize(CardView.java:203)
  at at android.support.v7.widget.CardView.<init>(CardView.java:101)
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:607)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
  at at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
  at at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
  at at android.app.Activity.setContentView(Activity.java:2153)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.n_onCreate(Native Method)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Activity.performCreate(Activity.java:5976)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
  at at android.app.ActivityThread.access$800(ActivityThread.java:144)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
  at at android.os.Handler.dispatchMessage(Handler.java:102)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5221)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  at Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.cardview.R$styleable" on path: DexPathList[[zip file "/data/app/com.xamarin.supportv7cardview.sample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.supportv7cardview.sample-1/lib/arm, /vendor/lib, /system/lib]]
  at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  at ... 27 more
  at Suppressed: java.lang.ClassNotFoundException: android.support.v7.cardview.R$styleable
  at at java.lang.Class.classForName(Native Method)
  at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  at ... 28 more
  at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  --- End of inner exception stack trace ---
  at --- End of managed exception stack trace ---
  at java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:607)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
  at at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
  at at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
  at at android.app.Activity.setContentView(Activity.java:2153)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.n_onCreate(Native Method)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Activity.performCreate(Activity.java:5976)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
  at at android.app.ActivityThread.access$800(ActivityThread.java:144)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
  at at android.os.Handler.dispatchMessage(Handler.java:102)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5221)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  at Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/cardview/R$styleable;
  at at android.support.v7.widget.CardView.initialize(CardView.java:203)
  at at android.support.v7.widget.CardView.<init>(CardView.java:101)
  at ... 25 more
  at Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.cardview.R$styleable" on path: DexPathList[[zip file "/data/app/com.xamarin.supportv7cardview.sample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.supportv7cardview.sample-1/lib/arm, /vendor/lib, /system/lib]]
  at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  at ... 27 more
  at Suppressed: java.lang.ClassNotFoundException: android.support.v7.cardview.R$styleable
  at at java.lang.Class.classForName(Native Method)
  at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  at ... 28 more
  at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available
  --- End of inner exception stack trace ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3236/ee215fc9/source/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (IntPtr jobject, IntPtr jclass, IntPtr jmethod, Android.Runtime.JValue* parms) [0x00084] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
  at Android.App.Activity.SetContentView (Int32 layoutResID) [0x00070] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:4403
  at AndroidSupportSample.MainActivity.OnCreate (Android.OS.Bundle bundle) [0x0000e] in /Users/Dennis/projects/cobalt-git/Rideshare-01/Components/xamandroidsupportv7cardview-23.1.1.1/samples/AndroidSupportSample/AndroidSupportSample/MainActivity.cs:27
  at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (IntPtr jnienv, IntPtr native__this, IntPtr native_savedInstanceState) [0x00011] in /Users/builder/data/lanes/3236/ee215fc9/source/monodroid/src/Mono.Android/platforms/android-15/src/generated/Android.App.Activity.cs:2212
  at at (wrapper dynamic-method) System.Object:855888e7-3749-47dd-bc4c-c0cf15ffd7a6 (intptr,intptr,intptr)
  at --- End of managed exception stack trace ---
  at android.view.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.CardView
  at at android.view.LayoutInflater.createView(LayoutInflater.java:633)
  at at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:743)
  at at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
  at at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
  at at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:377)
  at at android.app.Activity.setContentView(Activity.java:2153)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.n_onCreate(Native Method)
  at at md5b5c4d68d7f0084075bca6dac9c5e1a71.MainActivity.onCreate(MainActivity.java:28)
  at at android.app.Activity.performCreate(Activity.java:5976)
  at at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1105)
  at at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2251)
  at at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2360)
  at at android.app.ActivityThread.access$800(ActivityThread.java:144)
  at at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1278)
  at at android.os.Handler.dispatchMessage(Handler.java:102)
  at at android.os.Looper.loop(Looper.java:135)
  at at android.app.ActivityThread.main(ActivityThread.java:5221)
  at at java.lang.reflect.Method.invoke(Native Method)
  at at java.lang.reflect.Method.invoke(Method.java:372)
  at at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:898)
  at at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
  at Caused by: java.lang.reflect.InvocationTargetException
  at at java.lang.reflect.Constructor.newInstance(Native Method)
  at at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
  at at android.view.LayoutInflater.createView(LayoutInflater.java:607)
  at ... 22 more
  at Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/support/v7/cardview/R$styleable;
  at at android.support.v7.widget.CardView.initialize(CardView.java:203)
  at at android.support.v7.widget.CardView.<init>(CardView.java:101)
  at ... 25 more
  at Caused by: java.lang.ClassNotFoundException: Didn't find class "android.support.v7.cardview.R$styleable" on path: DexPathList[[zip file "/data/app/com.xamarin.supportv7cardview.sample-1/base.apk"],nativeLibraryDirectories=[/data/app/com.xamarin.supportv7cardview.sample-1/lib/arm, /vendor/lib, /system/lib]]
  at at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:469)
  at ... 27 more
  at Suppressed: java.lang.ClassNotFoundException: android.support.v7.cardview.R$styleable
  at at java.lang.Class.classForName(Native Method)
  at at java.lang.BootClassLoader.findClass(ClassLoader.java:781)
  at at java.lang.BootClassLoader.loadClass(ClassLoader.java:841)
  at at java.lang.ClassLoader.loadClass(ClassLoader.java:504)
  at ... 28 more
  at Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

1 个答案:

答案 0 :(得分:0)

如果您在添加的库项目中发现任何问题,请修复这些问题

在eclipse中项目&gt;清理库项目,Android项目将解决问题