我試圖RecyclerView和CardView添加到我的項目RecyclerView ClassNotFound的
dependencies {
compile 'com.android.support:appcompat-v7:21.0.0'
compile 'com.android.support:support-v13:21.0.0'
compile 'com.android.support:cardview-v7:21.0.0'
compile 'com.android.support:recyclerview-v7:21.0.0'
compile 'com.viewpagerindicator:library:[email protected]'
compile project(':facebook')
}
它編譯,但我得到的異常以下時,對設備
Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.RecyclerView" on path: DexPathList[[zip file "/data/app/xxxx.apk"],nativeLibraryDirectories=[/data/app-lib/xxxx, /vendor/lib, /system/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:497)
at java.lang.ClassLoader.loadClass(ClassLoader.java:457)
at android.view.LayoutInflater.createView(LayoutInflater.java:559)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:652)
是啊,看起來像我使用最新的buildtools,它確實有android.view.RecyclerView,所以在android studio中沒有錯誤,但我在4.4.4設備上運行它... – 2014-10-28 09:31:57
在我的佈局中,我寫過,仍然面臨同樣的問題。在CS類中,我能夠找到android.support.v7.widget,但不是android.support.v7.widget.RecyclerView – 2016-03-22 12:53:02