Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android build fails on 5.0.0+4 with 'Could not find method jvmToolchain' #107

Open
scheda74 opened this issue Jan 11, 2024 · 7 comments
Open

Comments

@scheda74
Copy link

Hey,
when building for android I'm getting the following errors:

A problem occurred evaluating project ':biometric_storage'.
> Could not find method jvmToolchain() for arguments [17] on extension 'kotlin' of type org.jetbrains.kotlin.gradle.dsl.KotlinAndroidProjectExtension.

A problem occurred configuring project ':biometric_storage'.
> Failed to notify project evaluation listener.
   > Cannot invoke method substring() on null object
   > compileSdkVersion is not specified. Please add it to build.gradle

I'm quite new to android, gradle and kotlin.
I think somewhere in my gradle config I have to wrong versions set.

I'm using

Flutter version 3.16.5
android-34, build-tools 34.0.0
OpenJDK 17.0.7+0-17.0.7b1000.6-10550314
gradle-7.5
ext.kotlin_version = '1.7.10'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.10"
id "com.android.application" version "7.3.0" apply false

To be honest I'm a bit confused about all of the versions of the different tools. It looks like that the biometric_storage plugin uses gradle 8.1. So does that mean I have to upgrade to that version? Which JDK and android-kotlin-plugin version should be used then?

@scheda74
Copy link
Author

After removing biometric_storage as a dependency my builds work just fine.

So instead I'm using a combination of local_auth and flutter_secure_storage as this package is broken (at least for me).

@vlad-buhaescu-qoob
Copy link

my temporary fix is to remove

kotlin {
jvmToolchain(17)
}

from the libary's Gradle file at /Users/"yourUser"/.pub-cache/hosted/pub.dev/biometric_storage-5.0.0+4/android/build.gradle

@roberto-gigli
Copy link

I don't have explicitly set
kotlin { jvmToolchain(17) }
Yet i get the same error, any news onto why this happens?

@vlad-buhaescu-qoob
Copy link

it's set in the library by default for you.

@ChauCM
Copy link

ChauCM commented May 21, 2024

upgrade kotlin version and build:gradle works for me, probably just kotlin_version is enough
from
ext.kotlin_version = '1.7.x'
to
ext.kotlin_version = '1.8.20'

@tungt84
Copy link

tungt84 commented Jun 23, 2024

I update android/build.gradle
buildscript {
ext.kotlin_version = '1.9.22' //use latest version
}
but same issue. Any help

@jvinai
Copy link

jvinai commented Jul 3, 2024

I have the same error, any fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants