java - 安卓3.3.0更新,错误: Cause: invalid type code: 68

在 Android Studio (3.3.0) 的新更新之后,我从 Gradle 同步中收到错误消息“错误:原因:无效类型代码:68”。即使在项目中,它也是在更新之前创建的,根本没有改变。 我尝试重新安装 Android Studio,但也没有帮助,所以肯定有一些与我的项目不兼容的东西,但它没有说明是什么以及为什么。

应用分级:

apply plugin: 'com.android.application'

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "cz.cubeit.cubeit"
        minSdkVersion 21
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'com.android.support:appcompat-v7:28.0.0'
    implementation 'com.android.support:cardview-v7:28.0.0'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
    implementation 'com.android.support:support-v4:28.0.0'
    implementation 'com.android.support:design:28.0.0'
}

项目等级:

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    ext.kotlin_version = '1.3.11'
    ext.anko_version='0.10.7'
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.3.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

最佳答案

我遇到了同样的问题。我在两台电脑上做一个项目:一台在我的办公室,一台在家里。在我的办公室,在更新 AS 3.3 之后,一切都很好,但在家里,按照我在办公室执行的相同步骤,出现了错误代码 68。

几个小时后,我想出了如何解决它。 Android Studio 3.3 在Settings>Experimental中默认启用了“Only sync the active variant”选项。 禁用此功能可解决问题。但重新激活该功能仍会显示相同的错误,即使在 Gradle 同步成功后也是如此。所以我认为这不是一个完整的解决方案,但至少现在我可以工作了。

https://stackoverflow.com/questions/54214605/

相关文章:

properties - 将静态变量从 Java 转换为 Kotlin

kotlin - 如何抑制未经检查的强制转换警告?

kotlin - 如果事件是用 Kotlin 编写的,则按钮 onClick 属性为无

android - ArrayAdapter 使用 Kotlin android

hibernate - 如何使用 JpaRepository 进行批量(多行)插入?

android - Kotlin - 如何在 "lateinit"和 "nullable varia

java - 如何使用 Maven 编译 Java+Kotlin 项目?

kotlin - 我可以省略在 Kotlin 中不使用的接口(interface)方法吗?

types - 为什么 Kotlin Array 不实现 Iterable

java - 为什么可以在 Kotlin 的类之外编写函数?