Architecture-components-samples: Failed to complete Gradle execution

Created on 18 May 2017  ·  14Comments  ·  Source: android/architecture-components-samples

Error:Failed to complete Gradle execution.

Cause:
The version of Gradle you are using (3.4.1) does not support the forTasks() method on
BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

Step to Reproduce:
Click the green arrow to build and run the APP

Most helpful comment

if your using Android Studio 3.0 canary 1 please update gradle as follows
~
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
~

and gradle wrapper as follows
~
-distributionUrl=https://services.gradle.org/distributions/gradle-3.4.1-all.zip
+distributionUrl=https://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
~

All 14 comments

Using Android Studio 3.0 canary 1

I have these errors:
Failed to resolve: android.arch.lifecycle:extensions:1.0.0-alpha1
Failed to resolve: annotationProcessor
Failed to resolve: android.arch.persistence.room:runtime:1.0.0-alpha1

because i can't connect https://maven.google.com ? ?

@Aeolus-dan Maybe, you should try again.

if your using Android Studio 3.0 canary 1 please update gradle as follows
~
- classpath 'com.android.tools.build:gradle:2.3.1'
+ classpath 'com.android.tools.build:gradle:3.0.0-alpha1'
~

and gradle wrapper as follows
~
-distributionUrl=https://services.gradle.org/distributions/gradle-3.4.1-all.zip
+distributionUrl=https://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip
~

@shanuka

OK, update the gradle will end up with the data binding error, which may relate to #1

@wafer-li
revert what you did in above comment and
type following command

~
./gradlew installDebug
~

Install issue fixed by this PR.

Still compile failed, to be crazy, help me

Failed to resolve: annotationProcessor Open File

Error:Execution failed for task ':app:javaPreCompileDebug'.

Could not resolve all files for configuration ':app:_debugAnnotationProcessor'.
Could not resolve all dependencies for configuration ':app:_debugAnnotationProcessor'.
Could not resolve android.arch.lifecycle:compiler:1.0.0-alpha1.
Required by:
project :app
Could not resolve android.arch.lifecycle:compiler:1.0.0-alpha1.
Could not get resource 'https://maven.google.com/android/arch/lifecycle/compiler/1.0.0-alpha1/compiler-1.0.0-alpha1.pom'.
Could not GET 'https://maven.google.com/android/arch/lifecycle/compiler/1.0.0-alpha1/compiler-1.0.0-alpha1.pom'.
Connect to maven.google.com:443 [maven.google.com/216.58.200.238] failed: Connection timed out: connect
Could not download compiler.jar (android.arch.persistence.room:compiler:1.0.0-alpha1)
Could not get resource 'https://maven.google.com/android/arch/persistence/room/compiler/1.0.0-alpha1/compiler-1.0.0-alpha1.jar'.
Could not GET 'https://maven.google.com/android/arch/persistence/room/compiler/1.0.0-alpha1/compiler-1.0.0-alpha1.jar'.
Connect to maven.google.com:443 [maven.google.com/216.58.200.238] failed: Connection timed out: connect

@chenyc
which is android studio version you may using?

@shanuka
Android Studio 3.0 canary 1
I did as you said above, but still can not solve

@chenycu
It seems you need to cross the Great Fire Wall

@chenycu
You need VPN

I have used the VPN, you can normally visit google.
Sometimes reported the following @@mistakes:

Information:Gradle_ tasks [:app:generateDebugSources, :app:mockableAndroidJar, :app:generateDebugAndroidTestSources]
Error:Execution failed for task ':app:mockableAndroidJar'.
Could not initialize class com.android.ide.common.util.ReadWriteProcessLock
Information:BUILD FAILED in 1s
Information:1 error
Information:0 warnings
Information:See complete output in console

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:mockableAndroidJar'.
    Could not initialize class com.android.ide.common.util.ReadWriteProcessLock
  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED in 1s
14 actionable tasks: 5 executed, 9 avoided (64%)

I hit an error when I clicked on --stacktrace

Error:java.lang.NoClassDefFoundError: Could not initialize class >com.android.ide.common.util.ReadWriteProcessLock

@shanuka @wafer-li @ouyangzn

open “gradle-wrapper.properties”,change:

distributionUrl=https://services.gradle.org/distributions/gradle-4.0-milestone-1-all.zip

Was this page helpful?
0 / 5 - 0 ratings