【问题标题】:Failed to resolve: recyclerview-1.1.0 Affected Modules: app无法解决:recyclerview-1.1.0 受影响的模块:app
【发布时间】:2020-09-17 19:06:34
【问题描述】:

我没有在 stackoverflow 或任何地方找到解决此问题的方法。 我只是将我的项目转移到 android studio 4.0.1 并迁移到 androidx 并收到此错误:

这是包含 recyclerview 的 xml 文件中的错误

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(项目)

// 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
}

如果您需要更多信息,请告诉我。

谢谢你的回答:)

【问题讨论】:

  • 你跳过Clean ProjectInvalidate Caches / Restart的舞蹈吗?
  • @cactustictacs 是的。没用。

标签: android android-studio gradle android-recyclerview


【解决方案1】:

解决了!

我把implementation 'com.google.android.material:material:1.2.1'改成了

implementation 'com.google.android.material:material:1.0.0' 。 之后我将此代码添加到

gradle.properties(项目属性)

android.useAndroidX=true

android.enableJetifier=true

最终的 gradle.properties(项目属性)代码必须是这样的:

# 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

【讨论】:

    【解决方案2】:

    我认为您不需要在 build.gradle 中导入回收站视图,因为您的 androidx.appcompat:appcompat:1.2.0 应该带有回收站视图库。

    所以从应该修复它的 build.gradle 中删除 implementation 'androidx.recyclerview:recyclerview:1.1.0'

    【讨论】:

      猜你喜欢
      • 2020-01-31
      • 1970-01-01
      • 2020-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-26
      • 1970-01-01
      • 2021-12-07
      相关资源
      最近更新 更多