代码之家  ›  专栏  ›  技术社区  ›  Sidnetopia

Android 3.0.1错误:无法解析“”的依赖关系:app@debug/compileClasspath“:无法解析项目:app2

  •  -1
  • Sidnetopia  · 技术社区  · 8 年前

    我将项目“forecastie master master”从GitHub导入到我自己的项目中。我遵循导入项目的步骤。请帮助我解决此错误,我是导入项目的新手。

    我自己的项目的gradle:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.example.bumbleshet.tourpinas3"
            minSdkVersion 21
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
    
        }
        productFlavors {
        }
        buildToolsVersion '26.0.2'
    }
    
    dependencies {
    
        implementation fileTree(include: ['*.jar'], dir: 'libs')
        implementation 'com.android.support:appcompat-v7:26.1.0'
        implementation 'com.android.support:cardview-v7:26.1.0'
        // implementation 'com.android.support:design:26.0.0'
        //implementation 'com.android.support:design:26.0.0'
        //imlementation 'com.android.support:support-v4:26.0.0'
        implementation 'com.android.support:design:26.1.0'
        compile 'com.android.support.constraint:constraint-layout:1.0.2'
        //implementatoin 'com.android.support.constraint:constraint-layout:1.0.2'
        // implementation 'com.google.android.gms.play-servies:11.8.0'
        implementation 'com.lapism:searchview:4.0'
        implementation 'com.google.firebase:firebase-core:11.8.0'
        implementation 'com.google.firebase:firebase-database:11.8.0'
        implementation 'com.google.firebase:firebase-auth:11.8.0'
        implementation 'com.google.android.gms:play-services-maps:11.8.0'
        implementation 'com.google.android.gms:play-services-location:11.8.0'
        implementation 'com.google.android.gms:play-services-places:11.8.0'
    
        //implementation project (':app2')//{
           // exclude group: 'com.android.support', module:'library'
        //}
        testImplementation 'junit:junit:4.12'
        androidTestImplementation 'com.android.support.test:runner:1.0.1'
        androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
        implementation project(':app2')
    }
    apply plugin: 'com.google.gms.google-services'
    
    
    
    my imported project's gradle:
    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "cz.martykan.forecastie"
            minSdkVersion 21
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        }
    
        lintOptions {
            checkReleaseBuilds true
            abortOnError false
            xmlReport true
            htmlReport true
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
    
        }
        productFlavors {
        }
        buildToolsVersion '26.0.2'
    }
    
    
    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        testCompile 'junit:junit:4.12'
        implementation 'com.google.android.apps.dashclock:dashclock-api:+'
        implementation 'com.roughike:bottom-bar:1.4.0.1'
        implementation 'com.diogobernardino:williamchart:2.2'
    }
    

    设置。格拉德尔:

    include ':app2',':app'
    

    错误:

    Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
    
    Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
    
    Unable to resolve dependency for ':app@debugUnitTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
    
    Unable to resolve dependency for ':app@release/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
    
    Unable to resolve dependency for ':app@releaseUnitTest/compileClasspath': Could not resolve project :app2. <a href="openFile:C:../build.gradle">Open File</a><br><a href="Unable to resolve dependency for ":app@debug/compileClasspath": Could not resolve project :app2.">
    

    细节:

    Unable to resolve dependency for ':app@debugAndroidTest/compileClasspath': Could not resolve project :app2. Could not resolve project :app2.
    

    要求者:项目:app

    找不到项目app2的匹配配置: -配置“debugApiElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,并找到兼容值“debug”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“debug”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,并找到兼容值“java api”。 -配置“debugMetadataElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,并找到兼容值“debug”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Metadata”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“debug”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,但未提供值。 -配置“debugRuntimeElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,并找到兼容值“debug”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“debug”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,发现不兼容的值“java runtime”。 -配置“ProfileAPIEments”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“profile”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“profile”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,并找到兼容值“java api”。 -配置“profileMetadataElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“profile”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Metadata”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“profile”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,但未提供值。 -配置“profileRuntimeElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“profile”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“profile”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,发现不兼容的值“java runtime”。 -配置“releaseApiElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“release”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“发布”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,并找到兼容值“java api”。 -配置“ReleaseMataElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“release”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Metadata”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“发布”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,但未提供值。 -配置“releaseRuntimeElements”: -必需的com。安卓建筑应用程序编程接口。属性。BuildTypeAttr“debug”,发现不兼容的值“release”。 -必需的com。安卓建筑格拉德尔。内部的附属国。AndroidTypeAttr“Aar”,发现不兼容的值“Apk”。 -找到com。安卓建筑格拉德尔。内部的附属国。VariantAttr“发布”,但不是必需的。 -所需组织。格拉德尔。应用程序编程接口。属性。使用“java api”,发现不兼容的值“java runtime”。

    1 回复  |  直到 8 年前
        1
  •  0
  •   Greg    8 年前

    不能将“Apk”作为模块导入应用程序。它需要是一个“Aar”。

    错误:

    Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'
    

    通常意味着您需要更改模块的构建。渐变自

    apply plugin: 'com.android.application'
    

    apply plugin: 'com.android.library'