【问题标题】:After install Android Studio 4.0 Failed to resolve: com.github.navasmdc:MaterialDesign:1.5安装Android Studio 4.0后无法解决:com.github.navasmdc:MaterialDesign:1.5
【发布时间】:2020-10-01 15:31:43
【问题描述】:

我使用com.github.navasmdc:MaterialDesign:1.5 没有问题,但是在升级 Android Studio 后,当我尝试构建时给我这个错误:

Failed to resolve: com.github.navasmdc:MaterialDesign:1.5
Show in Project Structure dialog
Affected Modules: app

我尝试在 libray 的 GitHub 中搜索,但没有更新版本。我上传了所有的实现,也没有解决。我升级和降级了插件,但没有解决我的问题。

我还能做什么?我想将 Android Studio 降级到 3.6 版。

我的构建 gradle 文件:

apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'



 android {
    compileSdkVersion 29
    defaultConfig {
        applicationId "com.taximetro.spia"
        minSdkVersion 21
        targetSdkVersion 29
        versionCode 1021
        versionName "2.0.5"
        multiDexEnabled true
        buildConfigField 'String', 'BUILD_TIME', 'new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss", java.util.Locale.getDefault()).format(new java.util.Date(' + System.currentTimeMillis() + 'L))'
    }

    lintOptions.abortOnError false

    packagingOptions {
        pickFirst 'lib/arm64-v8a/libtlvtree.so'
        pickFirst 'lib/armeabi-v7a/libpcltools.so'
        pickFirst 'lib/armeabi/libpcltools.so'
        pickFirst 'lib/armeabi/libtlvtree.so'
        pickFirst 'lib/x86/libpcltools.so'
        pickFirst 'lib/arm64-v8a/libpcltools.so'
        pickFirst 'lib/armeabi-v7a/libtlvtree.so'
        pickFirst 'lib/x86_64/libtlvtree.so'
        pickFirst 'lib/x86_64/libpcltools.so'
        pickFirst 'lib/x86/libtlvtree.so'
    }

    dexOptions {
        preDexLibraries = false
    }

    sourceSets {
        main {
            //manifest.srcFile 'AndroidManifest.xml'
            //java.srcDirs = ['src']
            //res.srcDirs = ['res']
            assets.srcDirs = ['assets']
            jniLibs.srcDirs = ['../../SDK/Native Libraries']
        }
    }

    lintOptions {
        checkReleaseBuilds false
        // Or, if you prefer, you can continue to check for errors in release builds,
        // but continue the build even when errors are found:
        abortOnError false
    }


    buildTypes {
        release {
            signingConfig signingConfigs.release
            debuggable false
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility = '1.8'
        targetCompatibility = '1.8'
    }

    packagingOptions {
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'

        exclude 'org/apache/http/version.properties'
        exclude 'org/apache/http/client/version.properties'
    }

    dexOptions {
        javaMaxHeapSize "4g"
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    lintOptions {
        abortOnError false
    }

}

dependencies {
    def lifecycle_version = "1.1.1"
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    //noinspection GradleCompatible
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'com.google.android.material:material:1.1.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    testImplementation 'junit:junit:4.13'
    androidTestImplementation 'androidx.test.ext:junit:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'androidx.gridlayout:gridlayout:1.0.0'
    implementation 'com.google.android.gms:play-services-maps:17.0.0'
    implementation 'com.google.android.gms:play-services-location:17.0.0'
    implementation 'com.google.android.gms:play-services-places:17.0.0'
    implementation 'com.google.http-client:google-http-client-gson:1.17.0-rc'
    implementation project(':PclServiceLib_2.04.00')
    implementation project(':PclUtilities_2.04.00')
    implementation 'com.github.gcacace:signature-pad:1.2.1'
    implementation 'androidx.cardview:cardview:1.0.0'

    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'


    implementation 'com.squareup.retrofit2:retrofit:2.6.1'

    implementation 'io.reactivex.rxjava2:rxjava:2.2.11'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
    implementation 'com.google.code.gson:gson:2.8.6'

    implementation "androidx.lifecycle:lifecycle-extensions:2.2.0"
    implementation 'androidx.core:core:1.2.0'

    implementation 'com.github.navasmdc:MaterialDesign:1.5@aar'
    //HotsPot
    implementation 'com.linkedin.dexmaker:dexmaker:2.25.0'
    //firebase
    implementation 'com.google.firebase:firebase-analytics:17.4.2'

另一个

buildscript {

    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.6.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 {
        mavenCentral()
        google()
        jcenter()
    }
}

ext{
    compileSdkVersion = 26
    supportLibVersion = "27.0.0"
    minSdkVersion = 14
    defaultTargetSdkVersion = 26
}


task clean(type: Delete) {
    delete rootProject.buildDir
}

【问题讨论】:

  • 您在gradle 中使用的是implements 还是compile?使用此依赖项添加您的 build.gradle
  • 检查您是否在build.gradlerepository 部分中添加了jcenter()
  • 我在存储库中使用实现 'com.github.navasmdc:MaterialDesign:1.5@aar' 和 jcenter()

标签: android-studio material-design upgrade resolve project-structure


【解决方案1】:

在 Android Studio 上测试:

  • 最新稳定版 - 3.6.3

  • 最新的金丝雀 - 4.1. Beta 1

和:

@aar 一起工作(最后)

implementation 'com.github.navasmdc:MaterialDesign:1.5@aar'

并且不推荐使用compile

compile 'com.github.navasmdc:MaterialDesign:1.5@aar'

不要在没有@aar 的情况下工作(最后)

implementation 'com.github.navasmdc:MaterialDesign:1.5'

也不适用于已弃用的compile

compile 'com.github.navasmdc:MaterialDesign:1.5'

解决方案

所以也许你没有在你的依赖中添加@aar

您发布了1.5,但应该是1.5@aar

【讨论】:

  • 我有实现: implementation 'com.github.navasmdc:MaterialDesign:1.5@aar' ,我尝试像你说的那样弃用,但结果相同 无法解决:com.github .navasmdc:MaterialDesign:1.5
  • @MarcelaDueñas 你会将你的两个 gradle 文件添加到你的问题中吗? :)
【解决方案2】:

最后我必须使缓存无效并重新启动以构建 gradle 文件,似乎旧文件无法更新

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-09
    • 2014-10-07
    • 2017-01-08
    相关资源
    最近更新 更多