美文网首页
Unable to resolve dependency for

Unable to resolve dependency for

作者: 凉风入梦 | 来源:发表于2018-01-19 14:49 被阅读0次
    错误问题.png

    这是一类问题,在导入第三方项目中出现的类似问题解决

    Unable to resolve dependency for ':app@signingConfigs/compileClasspath': Could not resolve project :pulltorefresh.
    
    Could not resolve project :pulltorefresh.
    Required by:
        project :app
     > Unable to find a matching configuration of project :pulltorefresh:
         - Configuration 'debugApiElements':
             - Required com.android.build.api.attributes.BuildTypeAttr 'signingConfigs' and found incompatible value 'debug'.
             - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
             - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
             - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
         - Configuration 'debugRuntimeElements':
             - Required com.android.build.api.attributes.BuildTypeAttr 'signingConfigs' and found incompatible value 'debug'.
             - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
             - Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
             - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
         - Configuration 'releaseApiElements':
             - Required com.android.build.api.attributes.BuildTypeAttr 'signingConfigs' and found incompatible value 'release'.
             - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
             - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
             - Required org.gradle.api.attributes.Usage 'java-api' and found compatible value 'java-api'.
         - Configuration 'releaseRuntimeElements':
             - Required com.android.build.api.attributes.BuildTypeAttr 'signingConfigs' and found incompatible value 'release'.
             - Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found compatible value 'Aar'.
             - Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
             - Required org.gradle.api.attributes.Usage 'java-api' and found incompatible value 'java-runtime'.
    

    这是错误的详细内容展开,百度后找到解决方法:
    将app下的build.gradle中 buildTypes {}中的内容基本一致,有什么字段就都要有什么,例如app下build.gradle中都有这些内容:

     buildTypes {
            release {
                minifyEnabled false
                signingConfig signingConfigs.debug
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
    
            signingConfigs {
                debug {
                    storeFile file('debug.keystore')
                    storePassword "android"
                    keyAlias "androiddebugkey"
                    keyPassword "android"
                }
            }
        }
    

    而导入的pulltorefresh中的gradle可能只有这些内容

        buildTypes {
            release {
                minifyEnabled false
                signingConfig signingConfigs.debug
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
    }
    

    将singingConfigs直接粘贴复制过来问题即可解决.

    相关文章

      网友评论

          本文标题:Unable to resolve dependency for

          本文链接:https://www.haomeiwen.com/subject/yhwooxtx.html