Всякий раз, когда я пытался вставить recyclerview
, он не работает и показывает ту же ошибку, теперь я не знаю, как удалить это, пожалуйста, помогите мне быстро. те же проблемы возникают, когда я пытаюсь добавить cardview
в макет.
Мой API - 29
Версия SDK - 28
Я даже пытался уменьшить мой API но все равно ничего не происходит
Ошибка:
java.lang.NoClassDefFoundError: androidx/recyclerview/R$attr
at androidx.recyclerview.widget.RecyclerView.<init>(RecyclerView.java:650)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:403)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:186)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:144)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:309)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:418)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:429)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:333)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:323)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:394)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:200)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:572)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$5(RenderTask.java:698)
at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Ошибка (предупреждение)
This operation requires the library androidx.recyclerview:recyclerview:+.
Problem: Inconsistencies in the existing project dependencies found.
Version incompatibility between:
- androidx.appcompat:appcompat:1.1.0@aar
and:
- androidx.appcompat:appcompat:1.1.0@aar
With the dependency:
- androidx.annotation:*:1.1.0
versus:
- androidx.annotation:*:2.0.0
The project may not compile after adding this library.
Would you like to add it anyway?
build.gradle (приложение)
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.example.voiceprescription"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
android.defaultConfig.vectorDrawables.useSupportLibrary = true
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
def appcompat_version = "1.1.0"
implementation "androidx.appcompat:appcompat:$appcompat_version"
implementation "androidx.appcompat:appcompat-resources:$appcompat_version"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation "androidx.cardview:cardview:1.0.0"
implementation 'com.google.firebase:firebase-auth:19.2.0'
implementation 'com.google.firebase:firebase-database:19.2.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
build.grade (проект)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.google.gms:google-services:4.3.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}