Reputation: 1862
i didn't find the solution to this problem in stackoverflow or any where. I just transfer my project to android studio 4.0.1 and migrated to androidx and got this error:
and this is error in xml file that contains recyclerview
build.gradle(app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
buildToolsVersion "26.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.sadeghjfr22.market"
minSdkVersion 16
targetSdkVersion 30
versionCode 1
versionName "1.0"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0'
implementation 'com.squareup.picasso:picasso:2.3.2'
implementation 'com.nineoldandroids:library:2.4.0'
implementation 'com.daimajia.slider:library:1.1.5@aar'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.github.smarteist:autoimageslider:1.3.7-appcompat'
implementation 'com.synnapps:carouselview:0.1.5'
implementation 'de.hdodenhof:circleimageview:2.1.0'
implementation 'cn.pedant.sweetalert:library:1.3'
implementation 'com.jakewharton:butterknife:8.8.1'
implementation 'com.melnykov:floatingactionbutton:1.3.0'
implementation 'com.github.JustKiddingBaby:VercodeEditText:v1.0.5'
implementation 'uk.co.chrisjenx:calligraphy:2.3.0'
implementation 'com.zarinpal:purchase:0.0.8-beta'
testImplementation 'junit:junit:4.12'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
}
build.gradle(project)
// 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:4.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url 'https://jitpack.io'}
maven { url "https://maven.google.com" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
plz tell me if you need more information.
thank you for your answer :)
Upvotes: 0
Views: 2160
Reputation: 1862
SOLVED!
I changed implementation 'com.google.android.material:material:1.2.1'
to
implementation 'com.google.android.material:material:1.0.0'
.
after that i added this codes to
gradle.properties (Project Properties)
android.useAndroidX=true
android.enableJetifier=true
final gradle.properties (Project Properties) code must be like this :
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
#http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
Upvotes: 1
Reputation: 298
I think you do not need recycler view import in your build.gradle because your androidx.appcompat:appcompat:1.2.0
should come with recycler view library.
So get rid of implementation 'androidx.recyclerview:recyclerview:1.1.0'
from your build.gradle that should fix it.
Upvotes: 0