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()
}
Related
I have ejected Expo from my project to run it on react-native. the problem is run-android doesn't work and it has gradle problem.
here is my terminal result :
> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 863 file(s) to forward-jetify. Using 12 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'lasttry'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle-4.2.2.jar (com.android.tools.build:gradle:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.2/gradle-4.2.2.jar
> Could not find builder-4.2.2.jar (com.android.tools.build:builder:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/4.2.2/builder-4.2.2.jar
> Could not find bundletool-1.1.0.jar (com.android.tools.build:bundletool:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.1.0/bundletool-1.1.0.jar
> Could not find aapt2-proto-4.2.2-7147631.jar (com.android.tools.build:aapt2-proto:4.2.2-7147631).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/4.2.2-7147631/aapt2-proto-4.2.2-7147631.jar
> Could not find databinding-compiler-common-4.2.2.jar (androidx.databinding:databinding-compiler-common:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/4.2.2/databinding-compiler-common-4.2.2.jar
> Could not find sdklib-27.2.2.jar (com.android.tools:sdklib:27.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/27.2.2/sdklib-27.2.2.jar
> Could not find protos-27.2.2.jar (com.android.tools.analytics-library:protos:27.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/27.2.2/protos-27.2.2.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 2s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'lasttry'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not find gradle-4.2.2.jar (com.android.tools.build:gradle:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/4.2.2/gradle-4.2.2.jar
> Could not find builder-4.2.2.jar (com.android.tools.build:builder:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/4.2.2/builder-4.2.2.jar
> Could not find bundletool-1.1.0.jar (com.android.tools.build:bundletool:1.1.0).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/1.1.0/bundletool-1.1.0.jar
> Could not find aapt2-proto-4.2.2-7147631.jar (com.android.tools.build:aapt2-proto:4.2.2-7147631).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/build/aapt2-proto/4.2.2-7147631/aapt2-proto-4.2.2-7147631.jar
> Could not find databinding-compiler-common-4.2.2.jar (androidx.databinding:databinding-compiler-common:4.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/androidx/databinding/databinding-compiler-common/4.2.2/databinding-compiler-common-4.2.2.jar
> Could not find sdklib-27.2.2.jar (com.android.tools:sdklib:27.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/sdklib/27.2.2/sdklib-27.2.2.jar
> Could not find protos-27.2.2.jar (com.android.tools.analytics-library:protos:27.2.2).
Searched in the following locations:
https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/27.2.2/protos-27.2.2.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 2s
at makeError (D:\project\last\lasttry\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at D:\project\last\lasttry\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async runOnAllDevices (D:\project\last\lasttry\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (D:\project\last\lasttry\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
before this i was building app on my own device connected to PC. so i never tried simulator.
here is more data which might u need to see :
gradle-wrapper.properties :
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "30.0.2"
minSdkVersion = 21
compileSdkVersion = 30
targetSdkVersion = 30
ndkVersion = "21.4.7075529"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
maven { url 'https://www.jitpack.io' }
}
}
and here is what i have tried : ./gradlew clean , running on different port, installing new project
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
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()
}
while building cordova project i get the follwing error on running command cordova build android?
please help with the follwoing code
C:\Users\gaurav-s\hello>cordova build android
ANDROID_HOME=D:\adt-bundle-windows-x86-20140702\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.7.0
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:1.5.0.
Required by:
:android:unspecified
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradl
e/1.5.0/gradle-1.5.0.pom'. Received status code 407 from server: Proxy Authentic
ation Required
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: 10.001 secs
Error: Error code 1 for command: cmd with args: /s,/c,"C:\Users\gaurav-s\hello\p
latforms\android\gradlew cdvBuildDebug -b C:\Users\gaurav-s\hello\platforms\andr
oid\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
Build tools have been moved from maven to jcenter. Go to your gradle settings file. Change
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
to
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
It is better to update your gradle to latest version.
This is because of gradle error Download the file
http://services.gradle.org/distributions/gradle-2.14.1-all.zip
and extract it in any of directory and set the path by open cmd and
enter
setx path (extracted direstory)/bin
after reopen cmd and check whether the gradle is works or not by give
gradle -v
it shows the gradle version output .
Now the error is fixed run
ionic build android