错误:无法解析':app @ debug / compileClasspath'的依赖项:无法解析项目:java

时间:2020-04-09 09:23:40

标签: android

如何在android studio中添加模块依赖项?

项目结构 enter image description here

enter image description here

enter image description here

当我添加模块依赖项时,没有要添加的模块吗?

enter image description here

我的android studio版本:3.6.1

enter image description here

enter image description here

build.gradle文件

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

 defaultConfig {
    applicationId "com.example.thu"
    minSdkVersion 14
    targetSdkVersion 29
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android- 
optimize.txt'), 'proguard-rules.pro'
    }
}

}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation project(path: ':java')  //i edited here try this


}

错误:

ERROR: Unable to resolve dependency for ':app@debug/compileClasspath': Could 
not resolve project :java.
Show Details
Affected Modules: app

我该如何解决?

1 个答案:

答案 0 :(得分:0)

我认为您没有添加模块。首先,您应该以这种方式添加: image。 添加模块后,您可以添加依赖项