Skip to content

[Bug]: project fails to load in Android Studio #1539

Open
@gramound

Description

@gramound

Is there an existing issue for this?

  • I have searched the existing issues

Is there a StackOverflow question about this issue?

  • I have searched StackOverflow

Is this an issue related to one of the samples?

  • Yes, this is a specific issue related to this samples repo.

Sample app

Jetcaster

What happened?

The project fails to load in Android Studio (latest stable release 2024.3.1):

Multiple build operations failed.
    Could not create task ':core:data:compileDebugAndroidTestJavaWithJavac'.
    Could not create task ':core:data-testing:compileDebugAndroidTestJavaWithJavac'.
    Could not create task ':core:designsystem:compileDebugAndroidTestJavaWithJavac'.
    Could not create task ':mobile:compileDebugAndroidTestJavaWithJavac'.
Could not create task ':core:data:compileDebugAndroidTestJavaWithJavac'.
Failed to calculate the value of task ':core:data:compileDebugAndroidTestJavaWithJavac' property 'javaCompiler'.
Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any vendor, implementation=vendor-specific} for MAC_OS on aarch64.
No locally installed toolchains match and toolchain download repositories have not been configured.

I reported a similar issue with tv-samples JetStream back in October. android/tv-samples#192
This works for me, (although not sure about the github actions yml)

git grep -l JDK | xargs sed -i 's/JDK 17/JDK 21/g'
git grep -l java-version | xargs sed -i 's/java-version: 17/java-version: 21/g'
git grep -l jvmToolchain | xargs sed -i 's/jvmToolchain(17)/jvmToolchain(21)/g'
git grep -l jvmTarget | xargs sed -i 's/jvmTarget = "17"/jvmTarget = "21"/g'
git grep -l JavaVersion | xargs sed -i 's/JavaVersion.VERSION_17/JavaVersion.VERSION_21/g'

I'm not doing a pull request, because I don't know enough about why this was hardcoded to java 17 in the first place. Maybe I'm missing something.

Relevant logcat output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtriage meIssue that needs to be triaged

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions