1

我在我的 gradle 项目中收到此警告/错误: Unsupported Modules Detected: Compilation is not supported for following modules: io.github.dogo-Dogo, Dogo_main, Dogo_test. Unfortunately you can't have non-Gradle Java modules and Android-Gradle modules in one project.

我对 Gradle 并不完全熟悉,我搜索了这样的错误,只是在 Android 环境中找到了这些东西,但我只使用了 Kotlin 和一些库。

buildscript {
    ext.kotlin_version = '1.3.11'
    ext.ktor_version = '1.0.1'
    ext.dokka_version = '0.9.17'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
        classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
    }
}

plugins {
    id "org.jetbrains.dokka" version '0.9.17'
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
apply plugin: 'maven'


group 'io.github.dogo'
version '1.0-SNAPSHOT'



mainClassName = "io.github.dogo.core.boot.BootKt"

sourceCompatibility = 1.8

repositories {
    mavenCentral()
    jcenter()
    maven {url 'https://jitpack.io'}
    maven {
        name = 'sponge'
        url = 'https://repo.spongepowered.org/maven'
    }
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-reflect"
    compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"

    compile "io.ktor:ktor-server-core:$ktor_version"
    compile "io.ktor:ktor-server-netty:$ktor_version"

    compile 'net.dv8tion:JDA:3.8.1_447'
    compile 'org.mongodb:mongodb-driver:3.6.3'
    compile 'org.spongepowered:configurate-json:3.6'
    compile 'com.fasterxml.jackson.core:jackson-databind:2.0.1'
    compile 'com.mashape.unirest:unirest-java:1.3.1'

    compile 'org.slf4j:slf4j-simple:1.6.1'
    compile 'org.apache.logging.log4j:log4j-core:2.11.1'
    compile 'org.apache.logging.log4j:log4j-api:2.11.1'

    compile 'org.jetbrains.kotlin:kotlin-script-runtime:1.3.11'
    compile 'org.jetbrains.kotlin:kotlin-script-util:1.3.11'
    compile 'org.jetbrains.kotlin:kotlin-compiler-embeddable:1.3.11'

    implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.0.1'
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

jar {
    manifest {
        attributes 'Main-Class': 'io.github.dogo.core.boot.BootKt'
    }
    from {
        configurations.compile
        .findAll { !it.name.endsWith('pom') }
        .collect { it.isDirectory() ? it : zipTree(it) }
    }
}

dokka {
    outputFormat = 'html'
    outputDirectory = "$buildDir/docs"
}

那么,我该如何解决这个错误/警告信息?我不确定,但我认为当我添加 Dokka(Kotlin 文档工具)时它开始出现

4

2 回答 2

1

Intellij IDEA 的建议修复对我有用 - 用于纯 Kotlin 工作(不包括任何 Android 跨界工作):

文件 -> 设置 -> 插件 -> 已安装选项卡 -> 取消选中“Android 支持”

并且日志事件消失了......(h / t Joern Mangels)

https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000404920/comments/360000086479

于 2019-01-27T05:22:53.917 回答
0

1-关闭项目

2-关闭 Android Studio IDE

3-删除.idea目录

4-删除所有 .iml 文件

5- 打开 Android Studio IDE 并导入项目

于 2020-05-24T12:51:28.960 回答