我刚刚尝试使用MaterialCalendarView,一个库:Here
但是,我得到的只是这些错误。我已经启用了Jetifier和AndroidX,并且已经坚持了几个小时。任何反馈将有所帮助。尝试导入类似的日历库时,我也遇到了类似的错误,并且实在毫无头绪,为什么会显示此错误。
java.lang.NoClassDefFoundError: com / prolificinteractive / materialcalendarview / R $ layout at com.prolificinteractive.materialcalendarview.MaterialCalendarView。(MaterialCalendarView.java:264) 在sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native 方法) sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) 在 sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 在java.lang.reflect.Constructor.newInstance(Constructor.java:423) 在 org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:403) 在 org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:186) 在 org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:144) 在 com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:299) 在 android.view.BridgeInflater.loadCustomView(BridgeInflater.java:418) 在 android.view.BridgeInflater.loadCustomView(BridgeInflater.java:429) 在 android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:333) 在 android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) 在 android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863) 在 android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72) 在android.view.LayoutInflater.rInflate(LayoutInflater.java:837)处 android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) 在android.view.LayoutInflater.inflate(LayoutInflater.java:515)处 android.view.LayoutInflater.inflate(LayoutInflater.java:394)位于 com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:325) 在com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:385) 在 com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193) 在 com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:509) 在 com.android.tools.idea.rendering.RenderTask.lambda $ inflate $ 4(RenderTask.java:638) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)在 java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) 在java.util.concurrent.FutureTask.run(FutureTask.java:266)在 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) 在 java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:617) 在java.lang.Thread.run(Thread.java:745)
dependencies {
// Room components
implementation 'android.arch.persistence.room:runtime:1.1.1'
annotationProcessor "android.arch.persistence.room:compiler:1.1.1"
androidTestImplementation 'android.arch.persistence.room:testing:1.1.1'
// Lifecycle components
implementation 'android.arch.lifecycle:extensions:1.1.1'
annotationProcessor "android.arch.lifecycle:compiler:1.1.1"
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-ml-vision:19.0.2'
implementation 'com.camerakit:camerakit:1.0.0-beta3.10'
implementation 'com.camerakit:jpegkit:0.1.0'
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.3.20'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.0.1'
implementation 'com.github.d-max:spots-dialog:1.1@aar'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.github.prolificinteractive:material-calendarview:2.0.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.0.2'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.2-alpha01'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.2-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
}