I'm trying to build and execute my cordova project, but i'm facing the error:
BUILD FAILED
Total time: 5.696 secs FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find common.jar (android.arch.core:common:1.1.0). Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not find common.jar (android.arch.core:common:1.1.0).
Searched in the following locations:
https://jcenter.bintray.com/android/arch/core/common/1.1.0/common-1.1.0.jar
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
The point is that the same project was able to build/run last week, and today dont work anymore.
Anyone had this problem and found some solution?
Open platforms/android/ then build.gradle
Add maven { url 'https://maven.google.com' } before jcenter()
allprojects
{
repositories {
maven {
url "https://maven.google.com"
}
jcenter()
}
}
google() and maven { url 'https://maven.google.com' } are pointing to the same repo, google() is a Google's Maven repo shortcut. You can add google() instead of maven { url 'https://maven.google.com' } IF you are using :
Gradle >= v.4.x+
It seems the order matters,
this works for me
Related
1: Task failed with an exception.
What went wrong:
Execution failed for task ':app:checkDebugAarMetadata'.
Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Could not find com.irozon.sneaker:sneaker:2.0.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/irozon/sneaker/sneaker/2.0.0/sneaker-2.0.0.pom
- https://repo.maven.apache.org/maven2/com/irozon/sneaker/sneaker/2.0.0/sneaker-2.0.0.pom
Required by:
project :app
Could not find com.kaopiz:kprogresshud:1.2.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/com/kaopiz/kprogresshud/1.2.0/kprogresshud-1.2.0.pom
- https://repo.maven.apache.org/maven2/com/kaopiz/kprogresshud/1.2.0/kprogresshud-1.2.0.pom
Required by:
project :app
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.
==============================================================================
It's not blame of Android Studio, it's just Gradle can't find your declared dependency in your maven repositories.
That library stores in jitpack repository you not declared, just declare it in repositories block in your build.gradle in app module.
maven { url 'https://jitpack.io' }
or if you use Gradle kotlin DSL
maven(url = "https://jitpack.io")
I have this error when I run flutter project for the first time
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.5.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.5.0.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.5.0/gradle-3.5.0.pom'.
> Remote host closed connection during handshake
* 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 1m 2s
Finished with error: Gradle task assembleDebug failed with exit code 1
How can I fix it ?
Note that I am running a project on genymotion
either you internet not working properly or add google() in gradle..
something like this
allprojects {
repositories {
google()
jcenter()
}
}
can you add the build build.gradle file so that we can see what is going wrong
When I hit ionic cordova run android the following is happening:
D:\Leraning\myApp>ionic cordova build android
> cordova build android
Android Studio project detected
Running command: "C:\Program Files\nodejs\node.exe" D:\Leraning\myApp\hooks\after_prepare\010_add_platform_class.js D:\Leraning\myApp
ANDROID_HOME=C:\Users\nagasatya.mandalapu\AppData\Local\Android\Sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_161
studio
Subproject Path: CordovaLib
Subproject Path: app
Starting a Gradle Daemon, 1 busy and 1 incompatible Daemons could not be reused, use --status for details
I have gradle installed and I tried by killing and restarting, but seems the same error.
update
D:\Leraning\myApp\platforms\android>gradle clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not resolve com.android.tools.build:gradle:3.0.0.
Required by:
project :
> Could not resolve com.android.tools.build:gradle:3.0.0.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Could not HEAD 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.0.0/gradle-3.0.0.pom'.
> Connect to repo.jfrog.org:443 [repo.jfrog.org/34.233.3.28, repo.jfrog.org/52.86.234.14] failed: Read timed out
* 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 1m 23s
D:\Leraning\myApp\platforms\android>
In the below part of the code from build.gradle
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
Replace
maven {
url 'https://maven.google.com'
}
with
google()
Final part would be
repositories {
jcenter()
google()
}
I have a project that uses com.android.support.test:runner:1.0.1 which I can run and unit test using AndroidStudio but when I try to run the project using the command line I get the following errors:
$ sh gradlew :myproject:clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':myproject'.
> Could not resolve all dependencies for configuration ':myproject:_normalDebugAndroidTestApkCopy'.
> Could not find com.android.support:support-annotations:25.0.2.
Searched in the following locations:
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/support-annotations/25.0.2/support-annotations-25.0.2.pom
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/support-annotations/25.0.2/support-annotations-25.0.2.jar
file:/Users/Joan/Development/myproject/git/android-tag/src/myproject/sdk-manager/com/android/support/support-annotations/25.0.2/support-annotations-25.0.2.jar
Required by:
project :myproject
> Could not find com.android.support.test:runner:1.0.1.
Searched in the following locations:
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/test/runner/1.0.1/runner-1.0.1.pom
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/test/runner/1.0.1/runner-1.0.1.jar
file:/Users/Joan/Development/myproject/git/android-tag/src/myproject/sdk-manager/com/android/support/test/runner/1.0.1/runner-1.0.1.jar
Required by:
project :myproject
> Could not find com.android.support.test:rules:1.0.1.
Searched in the following locations:
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/test/rules/1.0.1/rules-1.0.1.pom
file:/Users/Joan/SDKs/android-sdk/extras/android/m2repository/com/android/support/test/rules/1.0.1/rules-1.0.1.jar
file:/Users/Joan/Development/myproject/git/android-tag/src/myproject/sdk-manager/com/android/support/test/rules/1.0.1/rules-1.0.1.jar
Required by:
project :myproject
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 4.437 secs
I'm using gradle 2.3.3 and for now I can not update to the latest one because of some backward compatibility issues.
how can I fix this issue?
Thanks,
It looks like that you missed the maven { url 'https://maven.google.com' } in your build.gradle. That is why it only searched the maven cache.
Ensure you have something like this in your project's build.gradle:
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
}
Also, you can run the Gradle task as ./gradlew :myproject:clean instead of sh gradlew :myproject:clean.
i have download the android studio 2.2.2,use the gradle 2.14.1 gradle command to compile the project,but failed?
I input gradlew build but failed
the erro log is following
What went wrong:
A problem occurred configuring root project 'MyApplication'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:2.2.2.
Required by:
:MyApplication:unspecified
Could not resolve com.android.tools.build:gradle:2.2.2.
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/2.2.2/gradle-2.2.2.pom'.
Server sent an unsupported extension: type_35
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
in build.gradle change this:
repositories {
mavenCentral()
}
to this:
repositories {
mavenCentral()
jcenter()
}