如何将 android 库依赖项添加到 kotlin 模块?

问题描述 投票:0回答:1

我有一个简单的项目,其中包含 android 我的应用程序中的两个模块。一个是 kotlin 模块,另一个是 android 库。我想将 android 库添加为 kotlin 模块的依赖项。但是,当我尝试时出现错误

Could not resolve project :androidlibrary
.

有没有办法将 android 库实现到 kotlin 模块中?

kotlin 模块 Build.gradle

plugins {
    id 'java-library'
    id 'org.jetbrains.kotlin.jvm'
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_7
    targetCompatibility = JavaVersion.VERSION_1_7
}

dependencies {
    implementation(project(":androidlibrary"))
}

android 库 Build.gradle

plugins {
    id 'com.android.library'
    id 'org.jetbrains.kotlin.android'
}

android {
...
}

dependencies {
...
}
android gradle build.gradle modularity
1个回答
0
投票

取自Gradle无法解决项目:linkedin-sdk

只需更改:

implementation(project(":androidlibrary"))

compile project(path: ':androidlibrary', configuration: 'default')
© www.soinside.com 2019 - 2024. All rights reserved.