0

I am using Unity 6000.1.14f with a custom .aar plugin for a Standalone VR-App. The plugin uses AGP 8.7.3 and Gradle 8.12.1.

Complete Error message is:

Execution failed for task ':launcher:mergeDebugJavaResource'.
> Could not resolve all files for configuration ':launcher:debugRuntimeClasspath'.
   > Failed to transform fastdoubleparser-2.0.1.jar (ch.randelshofer:fastdoubleparser:2.0.1) to match attributes {artifactType=android-java-res, org.gradle.category=library, org.gradle.libraryelements=jar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for JetifyTransform: C:\Users\user\.gradle\caches\modules-2\files-2.1\ch.randelshofer\fastdoubleparser\2.0.1\ccf4a1c0441e7af5cf24c7b3a9766b2e2646bdea\fastdoubleparser-2.0.1.jar.
> Jetifier failed to transform: C:\Users\user\.gradle\caches\modules-2\files-2.1\ch.randelshofer\fastdoubleparser\2.0.1\ccf4a1c0441e7af5cf24c7b3a9766b2e2646bdea\fastdoubleparser-2.0.1.jar

The error was: java.lang.IllegalArgumentException - Unsupported class file major version 67 
To fix this issue, see https://issuetracker.google.com/issues/184622491

I first tried to follow the instructions at the issuetracker, but they did not work:

  1. I added the android.enableJetifier=false line to the custom gradle.properties file in Unity (gradleTemplate.properties).

  2. Then I removed that line and added the line android.jetifier.ignorelist = "fastdoubleparser-2.0.1.jar"

    The error persists on a clean build and after deleting the username/.gradle folder on disc (I use windwows 11). I also tried a google search, but that did not yield any other results.

For reference here is the setup of my .aar plugin and my dependencies in Unity.

AAR Setup:

The .aar is build build with gradle 8.12.1. My build.gradle.kts:

plugins {
    id("com.android.library")
    alias(libs.plugins.kotlin.android)
    id("org.jetbrains.kotlinx.dataframe")
    id("com.google.devtools.ksp")
}

// For correct initialisation order
apply(plugin = "org.jetbrains.kotlin.android")
apply(plugin = "com.android.library")
apply(plugin = "org.jetbrains.kotlinx.dataframe")
apply(plugin = "com.google.devtools.ksp")

androidComponents {
    beforeVariants { variant -\>
       variant.androidTest.enable = false
    }
}

android {
    namespace = "com.n8.polar_unity_bridge"
    compileSdk = 36
    defaultConfig {
        minSdk = 29
    }
    testBuildType = "debug"
    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
        getByName("debug") {
        isJniDebuggable = true
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }

// Stuff from here for the dataframe plugin https://kotlin.github.io/dataframe/setupandroid.html#kotlin-dataframe-compiler-plugin
    packaging {
        resources {
            pickFirsts += listOf(
                "META-INF/AL2.0",
                "META-INF/LGPL2.1",
                "META-INF/ASL-2.0.txt",
                "META-INF/LICENSE.md",
                "META-INF/NOTICE.md",
                "META-INF/LGPL-3.0.txt",
                "META-INF/thirdparty-LICENSE",
                "org/jetbrains/kotlinx/dataframe/documentation/**",
            )
            excludes += listOf(
                "META-INF/kotlin-jupyter-libraries/libraries.json",
                "META-INF/{INDEX.LIST,DEPENDENCIES}",
                "{draftv3,draftv4}/schema",
                "arrow-git.properties",
                "org/jetbrains/kotlinx/dataframe/documentation/**",
                "META-INF/*.kotlin_module",
                "META-INF/*",
                "META-INF/versions/9/module-info.class",
                "META-INF/versions/9/**",
            )
        }
    }
}

dependencies {
    implementation("com.google.dagger:dagger-compiler:2.57.1")
    ksp("com.google.dagger:dagger-compiler:2.57.1")
    compileOnly(files("libs/unity.jar"))
    implementation(libs.polar.ble.sdk)
    implementation(libs.kotlin.stdlib)
    implementation(libs.dataframe.csv)
    implementation(libs.kotlinx.serialization.json)
    implementation(libs.rxjava)
    implementation(libs.rxandroid)
    implementation(libs.androidx.runtime)
    implementation(libs.androidx.core.ktx)
}

The aar also uses this libs.versions.toml:


\[versions\]
agp = "8.7.3"
dataframe = "0.15.0"
kotlin = "2.2.0"
stdlib = "2.2.0"
coreKtx = "1.16.0"
kotlinxSerializationJson = "1.9.0"
polarBleSdk = "6.5.0"
rxandroid = "3.0.2"
rxjava = "3.1.11"
runtime = "1.8.0"

\[libraries\]
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "coreKtx" }
dataframe-csv = { module = "org.jetbrains.kotlinx:dataframe-csv", version.ref = "dataframe" }
kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "stdlib" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinxSerializationJson" }
polar-ble-sdk = { module = "com.github.polarofficial:polar-ble-sdk", version.ref = "polarBleSdk" }
rxandroid = { module = "io.reactivex.rxjava3:rxandroid", version.ref = "rxandroid" }
rxjava = { module = "io.reactivex.rxjava3:rxjava", version.ref = "rxjava" }
androidx-runtime = { group = "androidx.compose.runtime", name = "runtime", version.ref = "runtime" }

\[plugins\]
kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" }
android-library = { id = "com.android.library", version.ref = "agp" }

For Unity I use the Unity-Jar-Resolver, with this Editor/Dependencies.xml:

<dependencies>
    <androidPackages>
        <repositories>
            <repository>https://repo.maven.apache.org/maven2</repository>
            <repository>https://dl.google.com/dl/android/maven2/</repository>
            <repository>https://plugins.gradle.org/m2/</repository>
            <repository>https://jitpack.io</repository>
        </repositories>
        <!-- Polar BLE SDK -->
        <androidPackage spec="com.github.polarofficial:polar-ble-sdk:6.5.0" />
        <!-- "repositories" are optional and contain the set of additional
             repository URIs to search for this package. -->
        <repositories>
            <repository>https://jitpack.io</repository>
        </repositories>
        
        <!-- RxJava -->
        <androidPackage spec="io.reactivex.rxjava3:rxjava:3.1.11" />
        <!-- RxAndroid -->
        <androidPackage spec="io.reactivex.rxjava3:rxandroid:3.0.2" />
        
        <!-- AndroidX Core KTX -->
        <androidPackage spec="androidx.core:core-ktx:1.16.0" />
        <!-- AndroidX Compose Runtime -->
        <androidPackage spec="androidx.compose.runtime:runtime:1.8.0" />
        
        <!-- Kotlin Android 
        <androidPackage spec="org.jetbrains.kotlin.android:android:2.2.0" /> -->
        <!-- Kotlin Standard Library -->
        <androidPackage spec="org.jetbrains.kotlin:kotlin-stdlib:2.2.0" />
        <!-- Kotlinx Serialization JSON -->
        <androidPackage spec="org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0" />
        <!-- Kotlin DataFrame CSV -->
        <androidPackage spec="org.jetbrains.kotlinx:dataframe-csv:0.15.0" />
    </androidPackages>
</dependencies>
0

1 Answer 1

1

It doesn't know about JDK 23 classes:

Unsupported class file major version 67

You'd need to use fastdoubleparser-java17 instead of fastdoubleparser-java23.

https://github.com/wrandelshofer/FastDoubleParser

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks a lot! Could you point me to a solution how to do make android studio/gradle do that? So far I tried to add this snippet to my build.gradle.kts: configurations.all { resolutionStrategy.eachDependency { if (requested.group == "ch.randelshofer" && requested.name == "fastdoubleparser") { useTarget("ch.randelshofer:fastdoubleparser-java17:2.0.1") } } } But it does not find this repo on mavenCentral (obviously in hindsight :D). I also did not find a solution to force the java 17 release. I am really out of my depth, and appreciate all help!
You probably should read the README.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.