-
Notifications
You must be signed in to change notification settings - Fork 458
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
Unknown Kotlin JVM target: 21 #2051
Comments
I am also on December's Ladybug I'm assuming you tried to change it to 17 here. It did seem to work for many people: Looking through this, I think many others were also confused by the need to include kotlinOptions. It seems like specifying jvmTarget=1.8 is also unnecessary, since it's the default value: https://kotlinlang.org/docs/gradle-compiler-options.html#attributes-specific-to-jvm Overall, it does seem to be an Android Studio/Gradle/Java/Kotlin-related issue, rather than the Media3 library. |
If you clone the project and include the dependency "media-lib-common", you will also have the package "media-lib-common-ktx" included automatically, that forces you to setup kotlin. See build.gradle in media-lib-common:
To avoid this, remove this file in your filesystem: ...\android-media3\libraries\common_ktx\build.gradle |
Thank you for the answers. I understood the point. However, reading the official documentation, we have:
Therefore, I would like to suggest you to adjust it on your side, or add this info in the documentation. Because I understand that this may cause more questions, since the project is large and not everyone is an expert in Gradle, Kotlin and Java in general, like me. Please consider this as a suggestion. |
That's true. Updating documentations is always advised. Especially when v1.6.0 is highly depended on Kotlin. |
I tried to run the
demo
project following the documentation: I simply cloned the project and opened it in the root directory inside Android Studio, and I received the error "Unknown Kotlin JVM target: 21".After trying to make some Gradle JDK changes — for example, changing from 21 to 17 and others — I found a solution:
jbr-21 = 21.0.4
)build.gradle
of thedemo
project:It looks like this:
After this and sync project, I was able to run the demo project normally.
Was this some lack of knowledge on my side, or an incompatibility due to an Android Studio update (build on December 17, 2024)?
The text was updated successfully, but these errors were encountered: