Android Studio Dolphin | 2021.3.1 Patch 1 Build #AI-213.7172.25.2113.9123335, built on September 30, 2022 Runtime version: 11.0.13+0-b1751.21-8125866 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 8 Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=falseから
Android Studio Flamingo | 2022.2.1 Build #AI-222.4459.24.2221.9862592, built on March 31, 2023 Runtime version: 17.0.6+0-b2043.56-9586694 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 1280M Cores: 8 Registry: external.system.auto.import.disabled=true ide.text.editor.with.preview.show.floating.toolbar=false gradle.version.catalogs.dynamic.support=trueへアップデート(インストーラ "android-studio-2022.2.1.18-windows.exe” を実行しただけ)。
直後、Empty Views Activity テンプレートで 新規プロジェクトを作成するとビルド以前のエラー。原因は...▼
エラーメッセージ
File > Settings
Build, Execution, Deployment > Build Tools > Gradle
を
Gradle JDK > C:\Users\hatta\.jdks\openjdk-19
に変更し、
File > Sync Project with Gradle Files
で解消。無事 ビルド、実機で実行。
A problem occurred configuring root project 'FlappyBird'. > Could not resolve all files for configuration ':classpath'. > Could not resolve com.android.tools.build:gradle:8.0.0. Required by: project : > com.android.application:com.android.application.gradle.plugin:8.0.0 project : > com.android.library:com.android.library.gradle.plugin:8.0.0 > No matching variant of com.android.tools.build:gradle:8.0.0 was found. The consumer was configured to find a library for use during runtime, compatible with Java 8, packaged as a jar, and its dependencies declared externally, as well as attribute 'org.gradle.plugin.api-version' with value '8.0' but: - Variant 'apiElements' capability com.android.tools.build:gradle:8.0.0 declares a library, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component for use during compile-time, compatible with Java 11 and the consumer needed a component for use during runtime, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.0') - Variant 'javadocElements' capability com.android.tools.build:gradle:8.0.0 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.0') - Variant 'runtimeElements' capability com.android.tools.build:gradle:8.0.0 declares a library for use during runtime, packaged as a jar, and its dependencies declared externally: - Incompatible because this component declares a component, compatible with Java 11 and the consumer needed a component, compatible with Java 8 - Other compatible attribute: - Doesn't say anything about org.gradle.plugin.api-version (required '8.0') - Variant 'sourcesElements' capability com.android.tools.build:gradle:8.0.0 declares a component for use during runtime, and its dependencies declared externally: - Incompatible because this component declares documentation and the consumer needed a library - Other compatible attributes: - Doesn't say anything about its target Java version (required compatibility with Java 8) - Doesn't say anything about its elements (required them packaged as a jar) - Doesn't say anything about org.gradle.plugin.api-version (required '8.0')によれば 新しい gradle に Java 11 以上が必要らしい。現在の設定は
File > Settings
Build, Execution, Deployment > Build Tools > Gradle
を
Gradle JDK > C:\Users\hatta\.jdks\openjdk-19
に変更し、
File > Sync Project with Gradle Files
で解消。無事 ビルド、実機で実行。