【问题标题】:Unable to Resolve dependency:app@debug/compileClasspath': Could not resolve io.anyline:anylinesdk:5无法解决依赖关系:app@debug/compileClasspath':无法解析 io.anyline:anylinesdk:5
【发布时间】:2019-11-26 09:29:56
【问题描述】:

我正在开发一个由某人创建的 android 项目。在我的 Android 工作室中打开这个项目后,它给出了一个错误:

错误:无法解析 ':app@debug/compileClasspath' 的依赖关系: 无法解析 io.anyline:anylinesdk:5。

错误:无法解决依赖关系 ':app@debugAndroidTest/compileClasspath': 无法解析 io.anyline:anylinesdk:5.

//Build.gradle of my project
        apply plugin: 'com.android.application'
        apply plugin: 'kotlin-android-extensions'
        apply plugin: 'kotlin-android'
        android {
            compileSdkVersion project.ext.compile_sdk_version
            defaultConfig {
                applicationId "com.xyz"
                minSdkVersion 23
                targetSdkVersion 26
                versionCode 5
                versionName "1.0.4"
                testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
                ndk {
                    abiFilters 'armeabi-v7a'
                }
                multiDexEnabled true
            }
            sourceSets { main { assets.srcDirs = ['src/main/assets', 'src/main/TrainedModels'] } }
            buildTypes {
                release {
                    minifyEnabled false
                    proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'

                }
            }


            compileOptions {
                sourceCompatibility = '1.8'
                targetCompatibility = '1.8'
            }
            lintOptions {
                checkReleaseBuilds false
                abortOnError false
            }
        }
        repositories {
            flatDir {
                dirs 'libs'
            }
            maven {
                url 'https://anylinesdk.blob.core.windows.net/maven/'
            }
            mavenCentral()
        }


        dependencies {
            implementation fileTree(dir: 'libs', include: ['*.jar'])
            testImplementation 'junit:junit:4.12'
            implementation "com.android.support:support-v4:$support_version"
            implementation "com.android.support:appcompat-v7:$support_version"
            implementation "com.android.support:design:$support_version"
            implementation "com.android.support:cardview-v7:$support_version"
            implementation "com.android.support:preference-v14:$support_version"
            implementation 'com.github.bumptech.glide:glide:3.8.0'
            implementation 'com.squareup.retrofit2:retrofit:2.3.0'
            implementation 'com.squareup.retrofit2:converter-gson:2.0.2'
            implementation 'com.squareup.okhttp3:logging-interceptor:3.4.1'
            implementation 'com.squareup.okhttp3:okhttp:3.10.0'
            implementation "com.squareup.retrofit2:adapter-rxjava2:2.3.0"
            androidTestImplementation 'com.android.support.test:runner:1.0.2'

            implementation 'io.anyline:anylinesdk:5@aar'

            implementation 'org.greenrobot:eventbus:3.1.1'

            implementation 'com.squareup.picasso:picasso:2.71828'
            implementation 'com.googlecode.libphonenumber:libphonenumber:7.2.2'
        //
            implementation ('com.google.android.gms:play-services-base:11.6.0'){
                force=true
            }
            implementation ('com.google.android.gms:play-services-auth-api-phone:11.6.0'){
                force=true
            }
        //Optional for phone number hint
            implementation ('com.google.android.gms:play-services-auth:11.6.0'){
                force=true
            }
            implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"

        }
        repositories {
            mavenCentral()
    }

谁能帮帮我。

【问题讨论】:

标签: android android-studio


【解决方案1】:

这里的问题是 anyline sdk 集成

将 Anyline SDK 添加到 build.gradle 中的依赖项

repositories {
//add the anyline maven repo
maven { url 'https://anylinesdk.blob.core.windows.net/maven/'}
}

dependencies {
//add the anyline sdk as dependency (maybe adapt version name)
compile 'io.anyline:anylinesdk:3.6.1@aar'
//... your other dependencies
}

或通过 aar 的本地副本

将 .aar 复制到项目的 libs 目录(app/libs)并适配 build.gradle。

将 Anyline SDK 添加到 build.gradle 中的依赖项

//root section of the file
repositories {
flatDir {
    dirs 'libs'
}
}

dependencies {
compile(name:'anylinesdk-3.6.1', ext:'aar')
//... your other dependencies
}

希望这会解决.....

【讨论】:

  • 格式化系统后,在格式化系统之前出现此错误,关于这个项目没有错误我的android studio能够解决所有依赖项
  • @Apoorv,很明显你的一些依赖文件已经消失了,很可能是 aar 文件
  • Varma Lanke,我认为没有 aar 文件,因为 anylinesdk 直接来自我的项目中的 maven,我已经支付了该 anylinesdk 的密钥。
【解决方案2】:

先清理项目(build->clean project) 然后迁移到 android x(重构 -> 迁移到 androidx) 允许 android studio 推荐的更改

【讨论】:

    【解决方案3】:

    错误已解决。现在Android studio可以下载anyline sdk了。出现此错误是因为url'https://anylinesdk.blob.core.windows.net/maven/'已被我公司的ITSEC阻止。

    感谢您的帮助

    【讨论】:

      猜你喜欢
      • 2018-12-15
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 1970-01-01
      • 2022-08-15
      • 2018-04-10
      • 2018-06-26
      • 1970-01-01
      相关资源
      最近更新 更多