【问题标题】:I get this error when refreshing gradle project: Cause: invalid type code: B3刷新 gradle 项目时出现此错误:原因:类型代码无效:B3
【发布时间】:2019-08-11 17:26:52
【问题描述】:

在我点击“刷新所有 gradle 项目”之后

我得到错误:

原因:类型代码无效:B3

我正在尝试刷新它,因为我添加了这个依赖项:

implementation 'com.squareup.okhttp3:okhttp:3.0.1'

compile 'com.squareup.okhttp3:okhttp:3.0.1'

现在想在类中导入 OkHttpClient 但它不起作用

Java 是 12.0.1 Gradle 是 5.5

毕业代码:

settings.gradle 文件:

    pluginManagement {
    repositories {
        mavenCentral()

        maven {
            url  "http://dl.bintray.com/mbuhot/maven"
        }
    }
    dependencies {
        compile 'mbuhot:eskotlin:0.7.0'
        compile group: 'com.mashape.unirest', name: 'unirest-java', version: '1.3.1'
        compile group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: '2.9.4'


        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:23.0.0'
        compile 'com.google.android.gms:play-services:8.4.0'
        compile 'com.squareup.okhttp:okhttp:2.5.0'

    }
}
rootProject.name = 'ndmWebApp'

build.gradle 文件:


    plugins {
    id 'org.springframework.boot' version '2.1.3.RELEASE'
    id 'org.jetbrains.kotlin.jvm' version '1.3.21'
    id 'org.jetbrains.kotlin.plugin.spring' version '1.3.21'
}

apply plugin: 'io.spring.dependency-management'

group = 'ProjectoFinal.ndmWebApp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'

repositories {
    mavenCentral()
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'com.fasterxml.jackson.module:jackson-module-kotlin'
    implementation 'org.jetbrains.kotlin:kotlin-reflect'
    implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
    //elasticSearch
    implementation 'org.springframework.boot:spring-boot-starter-data-elasticsearch'

    implementation 'com.squareup.okhttp3:okhttp:3.0.1'

    testImplementation 'org.springframework.boot:spring-boot-starter-test'
}

compileKotlin {
    kotlinOptions {
        freeCompilerArgs = ['-Xjsr305=strict']
        jvmTarget = '1.8'
    }

【问题讨论】:

  • 您使用的是哪个版本的 Gradle 和 Java?
  • 能否请您添加整个 build.gradle 代码?
  • @AndiCover Java 是 12.0.1 Gradle 是 5.5

标签: java gradle intellij-idea kotlin


【解决方案1】:

这似乎是带有 Java 11+、Gradle 5 和 IntelliJ 的 open bug。 据我所知,您有两种选择:

  1. 将 Gradle 降级到低于 5 的版本。
  2. 使用命令行在 IntelliJ 之外构建您的项目。

here也提到了这个bug。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-11-11
    • 2019-06-10
    • 1970-01-01
    • 1970-01-01
    • 2020-09-21
    • 2020-10-04
    • 1970-01-01
    相关资源
    最近更新 更多