简体   繁体   English

刷新gradle项目时收到此错误:原因:类型代码无效:B3

[英]I get this error when refreshing gradle project: Cause: invalid type code: B3

After I hit " Refresh all gradle projects " 在我点击“ 刷新所有gradle项目 ”之后

I get the error: 我得到错误:

Cause: invalid type code: B3 原因:类型代码无效:B3

I am trying to refresh it because I added this dependencies: 我尝试刷新它,因为我添加了以下依赖项:

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

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

and now want to import OkHttpClient in the class but it isn't working 现在想在类中导入OkHttpClient,但是它不起作用

Java is 12.0.1 Gradle is 5.5 Java是12.0.1 Gradle是5.5

Gradle code: 摇篮代码:

settings.gradle file: 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 file: 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'
    }

This seems to be an open bug with Java 11+, Gradle 5 and IntelliJ. 这似乎是Java 11 +,Gradle 5和IntelliJ的一个公开错误 As far as I have seen it you have two options: 据我所知,您有两种选择:

  1. Downgrade Gradle to a version below 5. 将Gradle降级到5以下的版本。
  2. Build your project outside of IntelliJ using the commandline. 使用命令行在IntelliJ外部构建项目。

This bug is also mentioned here . 这里也提到此错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法构建gradle项目:无效的类型代码:使用Java 11的B3 - Cannot build gradle project: invalid type code: B3 using Java 11 Gradle 项目同步错误:原因:类型代码无效:32 - Gradle error on project sync: Cause: invalid type code: 32 尝试在IntelliJ上构建Gradle项目时出现错误代码B0 - Error code B0 when trying to build gradle project on IntelliJ Android 3.3.0 更新,错误:原因:无效类型代码:68 - Android 3.3.0 update, ERROR: Cause: invalid type code: 68 更新到gradle 5.1.1并将项目更改为java 11后无法构建项目。无效的类型代码 - Can't build project after updating to gradle 5.1.1 and project to java 11. Invalid type code 尝试在Android Studio 0.6.1上创建新项目时收到Gradle同步错误 - I get a Gradle sync error when I try to create a new project on Android Studio 0.6.1 无法获得类型为org.gradle.api.Project的项目':app'的未知属性'VERSION_CODE' - Could not get unknown property 'VERSION_CODE' for project ':app' of type org.gradle.api.Project 在包含 Scanner.next() 的 class 上使用反射时,我收到“无效的常量类型 18”错误 - When using Reflections on a class containing Scanner.next() I get "invalid constant type 18" error 在包含 Scanner.next() 的 class 上使用反射时,我收到“无效的常量类型 18”错误 - When using Reflections on a class containing Scanner.next() I get "invalid constant type 18" error 在 Gradle 项目中获取 Kotlin/Java 代码中的版本 - Get Version in Kotlin/Java code in Gradle project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM