bigmeco
bigmeco

Reputation: 174

In the project, it doesn't see library imports in a separate module

In the project, in a separate module, it doesn't see imports from a third-party library, but it mostly recognizes them

\src\main\java\com\bigmeco\server\HostApi.kt: (3, 12): Unresolved reference: koushikdutta

:project

buildscript {

extra.set("version", { it: String -> rootProject.extra.get(it) as String })
extra.set("kotlin_version", "1.3.72")
extra.set("compose_version", "0.1.0-dev14")
extra.set("coroutines_version", "1.3.7")
extra.set("koin_version", "2.1.5")


repositories {
    google()
    jcenter()
}
dependencies {
    val getLocalVersion = rootProject.extra.get("version") as (String) -> String
    classpath ("org.koin","koin-gradle-plugin",getLocalVersion("koin_version"))
    classpath ("com.android.tools.build:gradle:4.1.0-alpha10")
    classpath(kotlin("gradle-plugin", getLocalVersion("kotlin_version")))

}}
tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)}

:module

plugins {
id("java-library")
id("kotlin")
id("koin") }

dependencies {
val getLocalVersion = rootProject.extra.get("version") as (String) -> String
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
implementation(kotlin("stdlib", getLocalVersion("kotlin_version")))
implementation("com.koushikdutta.async", "androidasync", "3.0.9") }

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

setting.gradle.kts

include (":app")
include (":server")
rootProject.name = "Mafia Local"

Upvotes: 1

Views: 192

Answers (1)

bigmeco
bigmeco

Reputation: 174

The problem was that the plug-in library "Android Sync" is dependent on "com. android. library" so I had to change the module to android-dependent

file on kotlin dsl

plugins {
id("com.android.library")
id("kotlin-android")
id("koin")
}

android {
    compileSdkVersion(29)
    buildToolsVersion("30.0.0")

    sourceSets {
        val main by getting
        main.java.srcDirs("src/kotlin")
        main.manifest.srcFile("src/main/AndroidManifest.xml")
        main.res.srcDirs("src/res")
    }
}

dependencies {
    val getLocalVersion = rootProject.extra.get("version") as (String) -> String
    implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
    implementation(kotlin("stdlib", getLocalVersion("kotlin_version")))
    implementation("com.koushikdutta.async", "androidasync", "3.0.9")
 }

Upvotes: 2

Related Questions