我正在尝试在 android studio LadyBug 2024.2.1 Patch 1 中构建一个简单的启动应用程序 在 android studio 中同步或构建项目失败。输出如下
Executing tasks: [:app:assemble, :app:testClasses] in *******
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'Whatsapp Notification Handler'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle-8.6.0.jar (com.android.tools.build:gradle:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/8.6.0/gradle-8.6.0.jar
> Could not find gradle-settings-api-8.6.0.jar (com.android.tools.build:gradle-settings-api:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-settings-api/8.6.0/gradle-settings-api-8.6.0.jar
> Could not find lint-model-31.6.0.jar (com.android.tools.lint:lint-model:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-model/31.6.0/lint-model-31.6.0.jar
> Could not find builder-8.6.0.jar (com.android.tools.build:builder:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/8.6.0/builder-8.6.0.jar
> Could not find manifest-merger-31.6.0.jar (com.android.tools.build:manifest-merger:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/31.6.0/manifest-merger-31.6.0.jar
> Could not find sdk-common-31.6.0.jar (com.android.tools:sdk-common:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdk-common/31.6.0/sdk-common-31.6.0.jar
> Could not find sdklib-31.6.0.jar (com.android.tools:sdklib:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/31.6.0/sdklib-31.6.0.jar
> Could not find repository-31.6.0.jar (com.android.tools:repository:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/repository/31.6.0/repository-31.6.0.jar
> Could not find gradle-api-8.6.0.jar (com.android.tools.build:gradle-api:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle-api/8.6.0/gradle-api-8.6.0.jar
> Could not find builder-test-api-8.6.0.jar (com.android.tools.build:builder-test-api:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-test-api/8.6.0/builder-test-api-8.6.0.jar
> Could not find ddmlib-31.6.0.jar (com.android.tools.ddms:ddmlib:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/ddms/ddmlib/31.6.0/ddmlib-31.6.0.jar
> Could not find aaptcompiler-8.6.0.jar (com.android.tools.build:aaptcompiler:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aaptcompiler/8.6.0/aaptcompiler-8.6.0.jar
> Could not find bundletool-1.16.0.jar (com.android.tools.build:bundletool:1.16.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.16.0/bundletool-1.16.0.jar
> Could not find aapt2-proto-8.6.0-11315950.jar (com.android.tools.build:aapt2-proto:8.6.0-11315950).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/8.6.0-11315950/aapt2-proto-8.6.0-11315950.jar
> Could not find crash-31.6.0.jar (com.android.tools.analytics-library:crash:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/crash/31.6.0/crash-31.6.0.jar
> Could not find tracker-31.6.0.jar (com.android.tools.analytics-library:tracker:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/tracker/31.6.0/tracker-31.6.0.jar
> Could not find shared-31.6.0.jar (com.android.tools.analytics-library:shared:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/shared/31.6.0/shared-31.6.0.jar
> Could not find lint-typedef-remover-31.6.0.jar (com.android.tools.lint:lint-typedef-remover:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/lint/lint-typedef-remover/31.6.0/lint-typedef-remover-31.6.0.jar
> Could not find databinding-compiler-common-8.6.0.jar (androidx.databinding:databinding-compiler-common:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/8.6.0/databinding-compiler-common-8.6.0.jar
> Could not find databinding-common-8.6.0.jar (androidx.databinding:databinding-common:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-common/8.6.0/databinding-common-8.6.0.jar
> Could not find baseLibrary-8.6.0.jar (com.android.databinding:baseLibrary:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/databinding/baseLibrary/8.6.0/baseLibrary-8.6.0.jar
> Could not find layoutlib-api-31.6.0.jar (com.android.tools.layoutlib:layoutlib-api:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/layoutlib/layoutlib-api/31.6.0/layoutlib-api-31.6.0.jar
> Could not find android-device-provider-ddmlib-proto-31.6.0.jar (com.android.tools.utp:android-device-provider-ddmlib-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-device-provider-ddmlib-proto/31.6.0/android-device-provider-ddmlib-proto-31.6.0.jar
> Could not find android-device-provider-gradle-proto-31.6.0.jar (com.android.tools.utp:android-device-provider-gradle-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-device-provider-gradle-proto/31.6.0/android-device-provider-gradle-proto-31.6.0.jar
> Could not find android-test-plugin-host-additional-test-output-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-additional-test-output-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-additional-test-output-proto/31.6.0/android-test-plugin-host-additional-test-output-proto-31.6.0.jar
> Could not find android-test-plugin-host-coverage-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-coverage-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-coverage-proto/31.6.0/android-test-plugin-host-coverage-proto-31.6.0.jar
> Could not find android-test-plugin-host-emulator-control-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-emulator-control-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-emulator-control-proto/31.6.0/android-test-plugin-host-emulator-control-proto-31.6.0.jar
> Could not find android-test-plugin-host-logcat-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-logcat-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-logcat-proto/31.6.0/android-test-plugin-host-logcat-proto-31.6.0.jar
> Could not find android-test-plugin-host-apk-installer-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-apk-installer-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-apk-installer-proto/31.6.0/android-test-plugin-host-apk-installer-proto-31.6.0.jar
> Could not find android-test-plugin-host-retention-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-host-retention-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-host-retention-proto/31.6.0/android-test-plugin-host-retention-proto-31.6.0.jar
> Could not find android-test-plugin-result-listener-gradle-proto-31.6.0.jar (com.android.tools.utp:android-test-plugin-result-listener-gradle-proto:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/utp/android-test-plugin-result-listener-gradle-proto/31.6.0/android-test-plugin-result-listener-gradle-proto-31.6.0.jar
> Could not find builder-model-8.6.0.jar (com.android.tools.build:builder-model:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder-model/8.6.0/builder-model-8.6.0.jar
> Could not find dvlib-31.6.0.jar (com.android.tools:dvlib:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/dvlib/31.6.0/dvlib-31.6.0.jar
> Could not find common-31.6.0.jar (com.android.tools:common:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/common/31.6.0/common-31.6.0.jar
> Could not find apkzlib-8.6.0.jar (com.android.tools.build:apkzlib:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apkzlib/8.6.0/apkzlib-8.6.0.jar
> Could not find protos-31.6.0.jar (com.android.tools.analytics-library:protos:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/31.6.0/protos-31.6.0.jar
> Could not find signflinger-8.6.0.jar (com.android:signflinger:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/signflinger/8.6.0/signflinger-8.6.0.jar
> Could not find zipflinger-8.6.0.jar (com.android:zipflinger:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/zipflinger/8.6.0/zipflinger-8.6.0.jar
> Could not find annotations-31.6.0.jar (com.android.tools:annotations:31.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/annotations/31.6.0/annotations-31.6.0.jar
> Could not find apksig-8.6.0.jar (com.android.tools.build:apksig:8.6.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/apksig/8.6.0/apksig-8.6.0.jar
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
BUILD FAILED in 493ms
但是在终端构建中运行完全相同的 android studio 的 gradle 任务成功,并且我在 build/outputs/apk/debug 文件夹中获得了一个不错的 APK。
我在终端运行的命令是
sudo ./gradlew :app:clean :app:assembleDebug :app:assembleDebugUnitTest :app:assembleDebugAndroidTest
日志说无法下载所需的依赖项。
我检查了一些链接,它们没问题。
你最好:
systemProp.org.gradle.internal.http.connectionTimeout=180000 systemProp.org.gradle.internal.http.socketTimeout=180000
再次同步并重建您的项目!