29

After the new update of Android Studio (3.3.0) I'm getting error from Gradle sync saying "ERROR: Cause: invalid type code: 68". Even in project, that have been created before the update and hasn't changed at all. I've tried to reinstall Android Studio, which hasn't helped either, so there has to be something incompatible with my project, but it doesn't say what and why.

App gradle:

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'
}

Project gradle:

// 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
}
Jakub Kostka
  • 551
  • 2
  • 7
  • 20
  • Have you tried to delete your .gradle folder and then "Sync project with Gradle files" + clean + make. The folder in Windows is at C:\Users\\.gradle – CuriousSuperhero Jan 16 '19 at 10:06
  • Yes I did, even deleting the ".idea" folder haven't helped in this case because it also occurs when creating a new project – Jakub Kostka Jan 17 '19 at 06:16
  • I have the same issue on my home PC, but in my office PC everything is fine. I'm working on the same project, with the same Gradle wrapper and same AS version. – Federico Mastrini Jan 17 '19 at 11:08
  • The accepted solution of this answer also works for `cause: invalid type code: 4A` – Hissaan Ali Oct 19 '19 at 14:21

5 Answers5

43

I had the same problem. I was working on a project on two PCs: one at my office and one at home. In my office, after the AS 3.3 update, everything was fine but at home, after the same steps that I did at the office, the Error code 68 came out.

After a couple of hours, I figured out how to solve it. Android Studio 3.3 has the " Only sync the active variant" option enabled by default in Settings>Experimental. Disabling this feature resolved the problem. But reactivating the feature the same error shows up, even after a successful Gradle sync. So I think this isn't a complete solution, but at least now I can work.

Javad Dehban
  • 1,282
  • 3
  • 11
  • 24
Federico Mastrini
  • 724
  • 11
  • 15
24

I had the same issu with IntelliJ 2019.1, Untick this option works for me. enter image description here

Arst
  • 3,098
  • 1
  • 35
  • 42
3

Alter path JDK location to .....\Android Studio\jre

2

I got a similar message ("invalid type code: E5") and resolved it by first building from the command line, which revealed it was a Firebase libs version conflict, and then switching to use firebase-bom instead of manually specifying each version.

Gabor
  • 7,352
  • 4
  • 35
  • 56
  • 1
    This is the only correct answer. Running something like `.\gradlew build` on the command line will give you actual error messages, which Android Studio hides for some reason (WTF, Google). – Andrew Koster Jul 29 '20 at 18:15
1

I had the same error (6C) during a LinkedIn Learning course, I managed to solve it through the following steps

  • Updating Kotlin in project-level build.gradle file
  • Update gradle build version in project-level build.gradle file.
  • Open Project Structure and using the Suggestions tab, update all modules to the latest version.
  • Update the compileSdkVersion & targetSdkVersion to latest.