gradle не может разрешить какую-либо зависимость для конфигурации: classpath

#java #gradle #intellij-idea

#java #gradle #intellij-idea

Вопрос:

все мои проекты, использующие gradle builder, имеют эту ошибку. gradle не может синхронизироваться, и ни одна из зависимостей не разрешается. это ошибка: не удалось разрешить все артефакты для configuration ‘:classpath’.

Не удалось найти com.android.tools.build:gradle: 6.7.1. Поиск в следующих местах: — https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom — https://jcenter.bintray.com/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom — https://repo.maven.apache.org/maven2/com/android/tools/build/gradle/6.7.1/gradle-6.7.1.pom Требуется: проект : Не удалось найти android.arch.navigation:navigation-safe-args-gradle-plugin: 2.3.0. Искал в следующих местах: —https://dl.google.com/dl/android/maven2/android/arch/navigation/navigation-safe-args-gradle-plugin/2.3.0/navigation-safe-args-gradle-plugin-2.3.0.pom — https://jcenter.bintray.com/android/arch/navigation/navigation-safe-args-gradle-plugin/2.3.0/navigation-safe-args-gradle-plugin-2.3.0.pomhttps://repo.maven.apache.org/maven2/android/arch/navigation/navigation-safe-args-gradle-plugin/2.3.0/navigation-safe-args-gradle-plugin-2.3.0.pom Требуется по: проекту: Возможное решение:


это мой файл build.gradle:

 buildscript {

repositories {
    google()
    jcenter()
    mavenCentral()
    
}
dependencies {
    classpath 'com.android.tools.build:gradle:6.7.1'
    classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:2.3.0'

}
}
allprojects {
repositories {
    google()
    jcenter()
    
}
}

task clean(type: Delete) {
delete rootProject.buildDir}
 

и это мой файл:app build.gradle

 apply plugin: 'com.android.application'
apply plugin: 'androidx.navigation.safeargs'

android {
compileSdkVersion 30
buildToolsVersion "30.0.2"

defaultConfig {
    applicationId "com.example.jartest2"
    minSdkVersion 16
    targetSdkVersion 30
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    }
}}

dependencies {
def nav_version = "2.3.0"
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.google.android.material:material:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.1'
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation "androidx.navigation:navigation-fragment:$nav_version"
implementation "androidx.navigation:navigation-ui:$nav_version"
implementation "androidx.navigation:navigation-runtime:$nav_version"
implementation 'androidx.annotation:annotation:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'}
 

и это файл журнала:

 INFO - j.ide.actions.RevealFileAction - Exit code 1 
2020-12-10 05:19:12,205 [47703891]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:12,596 [47704282]   INFO - rationStore.ComponentStoreImpl - Saving Project(name=JarTest2, containerState=COMPONENT_CREATED, componentStore=D:computerJavaIdeaProjectsJarTest2)JavacSettings took 16 ms 2020-12-10 05:19:12,706 [47704392]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:22,712 [47714398]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:23,226 [47714912]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:24,230 [47715916]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:24,746 [47716432]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:25,754 [47717440]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:26,263 [47717949]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:26,779 [47718465]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:27,294 [47718980]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:27,810 [47719496]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:28,326 [47720012]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:28,838 [47720524]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:29,344 [47721030]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:29,846 [47721532]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:30,354 [47722040]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:30,870 [47722556]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:31,385 [47723071]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:31,901 [47723587]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:31,932 [47723618]   INFO - System.util.ExternalSystemUtil - External project [D:/computer/Java/IdeaProjects/JarTest2] resolution task started` 2020-12-10 05:19:32,010 [47723696]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.8.0_72  2020-12-10 05:19:32,010 [47723696]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.8.0_72  2020-12-10 05:19:32,042 [47723728]   INFO - oject.common.GradleInitScripts - init script file sync.studio.tooling contents "initscript {n    dependencies {n        classpath files(['C:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2020.3\\plugins\\android\\lib\\android.jar', 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2020.3\\plugins\\android\\lib\\android.jar', 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2020.3\\lib\\kotlin-stdlib-1.4.0.jar'])n    }n}nallprojects {n    apply plugin: com.android.ide.gradle.model.builder.AndroidStudioToolingPluginn}n"  2020-12-10 05:19:32,057 [47723743]   INFO - xecution.GradleExecutionHelper - Passing command-line args to Gradle Tooling API: -Didea.sync.active=true -Didea.resolveSourceSetDependencies=true -Porg.gradle.kotlin.dsl.provider.cid=47899959731139 --init-script C:UsersM.HAppDataLocalTempsync.studio.tooling11867.gradle -Djava.awt.headless=true --stacktrace -Pandroid.injected.build.model.only=true -Pandroid.injected.build.model.only.advanced=true -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.build.model.only.versioned=3 -Pandroid.injected.studio.version=10.4.0.203.5981.155 -Pandroid.injected.build.model.disable.src.download=true -Pidea.gradle.do.not.build.tasks=false --init-script C:UsersM.HAppDataLocalTempijinit5.gradle  2020-12-10 05:19:32,409 [47724095]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:32,925 [47724611]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:42,652 [47734338]   INFO - .project.GradleProjectResolver - Gradle project resolve error  org.gradle.tooling.GradleConnectionException: Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-6.7.1-all.zip'.
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:55)
at org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:43)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:69)
at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:64)
at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:56)
at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.gradle.api.UncheckedIOException: java.io.StreamCorruptedException: invalid type code: 00
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:61)
at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:41)
at org.gradle.tooling.internal.provider.serialization.PayloadSerializer.deserialize(PayloadSerializer.java:78)
at org.gradle.tooling.internal.provider.ProviderConnection.throwFailure(ProviderConnection.java:231)
at org.gradle.tooling.internal.provider.ProviderConnection.run(ProviderConnection.java:219)
at org.gradle.tooling.internal.provider.ProviderConnection.runPhasedAction(ProviderConnection.java:179)
at org.gradle.tooling.internal.provider.DefaultConnection.run(DefaultConnection.java:245)
at org.gradle.tooling.internal.consumer.connection.PhasedActionAwareConsumerConnection.run(PhasedActionAwareConsumerConnection.java:56)
at org.gradle.tooling.internal.consumer.connection.ParameterValidatingConsumerConnection.run(ParameterValidatingConsumerConnection.java:62)
at org.gradle.tooling.internal.consumer.DefaultPhasedBuildActionExecuter$1.run(DefaultPhasedBuildActionExecuter.java:78)
at org.gradle.tooling.internal.consumer.DefaultPhasedBuildActionExecuter$1.run(DefaultPhasedBuildActionExecuter.java:70)
at org.gradle.tooling.internal.consumer.connection.LazyConsumerActionExecutor.run(LazyConsumerActionExecutor.java:130)
at org.gradle.tooling.internal.consumer.connection.CancellableConsumerActionExecutor.run(CancellableConsumerActionExecutor.java:45)
at org.gradle.tooling.internal.consumer.connection.ProgressLoggingConsumerActionExecutor.run(ProgressLoggingConsumerActionExecutor.java:61)
at org.gradle.tooling.internal.consumer.connection.RethrowingErrorsConsumerActionExecutor.run(RethrowingErrorsConsumerActionExecutor.java:38)
at org.gradle.tooling.internal.consumer.async.DefaultAsyncConsumerActionExecutor$1$1.run(DefaultAsyncConsumerActionExecutor.java:67)
... 6 more Caused by: java.io.StreamCorruptedException: invalid type code: 00
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1710)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.readArray(ObjectInputStream.java:2102)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1667)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2464)
at java.base/java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2358)
at java.base/java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2196)
at java.base/java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1679)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:493)
at java.base/java.io.ObjectInputStream.readObject(ObjectInputStream.java:451)
at org.gradle.tooling.internal.provider.serialization.PayloadSerializer.deserialize(PayloadSerializer.java:76)
... 19 more 2020-12-10 05:19:42,663 [47734349]   INFO - s.plugins.gradle.GradleManager - Instructing gradle to use java from C:/Program Files/Java/jdk1.8.0_72  2020-12-10 05:19:42,665 [47734351]   INFO - g.jetbrains.kotlin.idea.script - [KOTLIN_SCRIPTING] IllegalStateException loading gradle script templates: Unable to get Gradle home directory  2020-12-10 05:19:42,668 [47734354]   INFO - g.jetbrains.kotlin.idea.script - [KOTLIN_SCRIPTING] Cannot find valid gradle home for null with version = null, script models cannot be saved  2020-12-10 05:19:42,669 [47734355]   INFO - System.util.ExternalSystemUtil - External project [D:/computer/Java/IdeaProjects/JarTest2] resolution task executed in 10737 ms.  2020-12-10 05:19:42,961 [47734647]   INFO - .deployment.AsyncDevicesGetter - adb not found 2020-12-10 05:19:43,067 [47734753]   INFO - ge.ExternalProjectsDataStorage - Save external projects data in 46 ms  2020-12-10 05:19:43,462 [47735148]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:43,963 [47735649]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:44,467 [47736153]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:44,983 [47736669]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:45,487 [47737173]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:45,992 [47737678]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:46,487 [47738173]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:47,518 [47739204]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:52,052 [47743738]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:55,073 [47746759]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:55,588 [47747274]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:56,104 [47747790]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:56,620 [47748306]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:57,128 [47748814]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:19:57,630 [47749316]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:02,671 [47754357]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:03,678 [47755364]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:04,175 [47755861]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:09,781 [47761467]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:10,278 [47761964]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:10,778 [47762464]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:11,282 [47762968]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:12,282 [47763968]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:12,785 [47764471]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:13,287 [47764973]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:13,787 [47765473]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:14,291 [47765977]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:14,806 [47766492]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:15,322 [47767008]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:15,822 [47767508]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:16,338 [47768024]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:16,853 [47768539]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:17,360 [47769046]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:17,861 [47769547]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:19,365 [47771051]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:19,881 [47771567]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:21,420 [47773106]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:21,921 [47773607]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:22,421 [47774107]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:22,921 [47774607]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:23,418 [47775104]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:23,780 [47775466]   INFO - rationStore.ComponentStoreImpl - Saving appLangManager took 16 ms  2020-12-10 05:20:23,921 [47775607]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:28,929 [47780615]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:56,843 [47808529]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:20:57,358 [47809044]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:21:05,930 [47817616]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:21:06,430 [47818116]   INFO - .deployment.AsyncDevicesGetter - adb not found  2020-12-10 05:22:26,483 [47898169]   INFO - .deployment.AsyncDevicesGetter - adb not found 
 

Я проверяю подключение к Интернету. все работает нормально. после того, как я использую прокси, но все еще имею эту ошибку. Я обновляю свой intellij до 11.0.9 и java до 10, но это не помогает. Я проверяю путь JAVA_HOME, он определен правильно. Я удаляю папку .gradle в моем пользовательском доме и аннулирую кеши, перезапускаю и снова создаю проект, но это также не может помочь.
сейчас я использую Windows 10, intellij IDEA 11.0.9 и jdk 1.8. любая помощь будет признательна.

Ответ №1:

после поиска я обнаружил, что проблема заключалась в прокси. Я сменил прокси-сервер, и gradle работал правильно!