Whenever I run ionic cordova run android I get the following error:
> ionic cordova prepare
> cordova prepare
√ Running command - done!
Running command: "C:\Program Files\nodejs\node.exe" "C:\Users\Andy\Google Drive\Programming\moment\hooks\after_prepare\010_add_platform_class.js" "C:\Users\Andy\Google Drive\Programming\moment"
add to body class: platform-android
add to body class: platform-ios
> cordova run android
Running command: "C:\Program Files\nodejs\node.exe" "C:\Users\Andy\Google Drive\Programming\moment\hooks\after_prepare\010_add_platform_class.js" "C:\Users\Andy\Google Drive\Programming\moment"
add to body class: platform-android
ANDROID_HOME=C:\Users\Andy\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_111
Subproject Path: CordovaLib
null
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_55lwakjqtnxirerdx410ubatx.run(C:\Users\Andy\Google Drive\Programming\moment\platforms\android\build.gradle:139)
org.xwalk:xwalk_core_library:23+
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use TaskInputs.file(Object).skipWhenEmpty() instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugApkCopy'.
> Could not resolve org.xwalk:xwalk_core_library:23+.
BUILD FAILED
Required by:
project :
> Could not resolve org.xwalk:xwalk_core_library:23+.
> Failed to list versions for org.xwalk:xwalk_core_library.
> Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml.
> Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Total time: 26.521 secs
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 resolve all dependencies for configuration ':_armv7DebugApkCopy'.
> Could not resolve org.xwalk:xwalk_core_library:23+.
Required by:
project :
> Could not resolve org.xwalk:xwalk_core_library:23+.
> Failed to list versions for org.xwalk:xwalk_core_library.
> Unable to load Maven meta-data from https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml.
> Could not GET 'https://download.01.org/crosswalk/releases/crosswalk/android/maven2/org/xwalk/xwalk_core_library/maven-metadata.xml'. Received status code 503 from server: Service Unavailable
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Picked up _JAVA_OPTIONS: -Xmx512m
[ERROR] An error occurred while running cordova run android (exit code 1).
I found this post and have already tried to uninstall and reinstall Android Support Repository. Here is my SDK Manager:
I've also added this to my buid.gradle
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:recyclerview-v7:23.1.1'
Has anyone encountered this before? What is the fix?
I'm having the same issue. Looks like the download link might be broken/down?
See the report: https://crosswalk-project.org/jira/browse/XWALK-7553
Related
C:\Users\Tuladhar\WebstormProjects\myproject>ionic cordova build android
[WARN] Not performing Ionic build for project type: ionic1.
cordova build android
Running command: "C:\Program Files\nodejs\node.exe" C:\Users\Tuladhar\WebstormProjects\myproject\hooks\after_prepare\010_add_platform_class.js C:\Users\Tuladhar\WebstormProjects\myproject
add to body class: platform-android
ANDROID_HOME=C:\Users\Tuladhar\AppData\Local\Android\android-sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
Subproject Path: CordovaLib
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
at build_859uxik73yildsrgrru9xamjo.run(C:\Users\Tuladhar\WebstormProjects\myproject\platforms\android\build.gradle:141)
BUILD FAILED
Total time: 22.164 secs
FAILURE: Build failed with an exception.
What went wrong:
A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not open cp_proj remapped class cache for cxcpcn2de84br0eekalu3p9nv (C:\Users\Tuladhar.gradle\caches\3.3\scripts-remapped\build_c7ur6ql0tv1x27ryhuthd38ad\cxcpcn2de84br0eekalu3p9nv\cp_proj1efd45104ffa2d33563b85b9edda76e3).
Unexpected lock protocol found in lock file. Expected 3, found 0.
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 resolve all dependencies for configuration ':_debugApk'.
A problem occurred configuring project ':CordovaLib'.
Could not open cp_proj remapped class cache for cxcpcn2de84br0eekalu3p9nv (C:\Users\Tuladhar.gradle\caches\3.3\scripts-remapped\build_c7ur6ql0tv1x27ryhuthd38ad\cxcpcn2de84br0eekalu3p9nv\cp_proj1efd45104ffa2d33563b85b9edda76e3).
Unexpected lock protocol found in lock file. Expected 3, found 0.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
[ERROR] An error occurred while running cordova build android (exit code 1).
1.Remove platforms (you can delete it from folder)
2.Remove node_modules (you can delete it from folder)
3.Upgrade your ionic-cli version to the latest (npm update -g ionic )
4.run npm install
5.run ionic cordova platform add android
6.run ionic cordova run android
Try these steps accordingly and it will work. If not try updating android api and sdk tools and re-do the steps.
I've recently added a library to my react-native project. The project was running fine before adding this dependency. However, when I try tryi to run it now through react-native run-android I get this error:
File C:\Users\user\.android\repositories.cfg could not be loaded.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApkCopy'.
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app
> Could not find com.onesignal:OneSignal:23.0.1.
Required by:
project :app > project :react-native-onesignal
* 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: 1 mins 57.711 secs
Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/android-setup.html
Edit: The android emulator is of course running.
After doing som research I figured out that I could try npm uninstall and install, without success. In the build.gradle I have specified my onesignal_app_id, and compile 'com.onesignal:OneSignal:23.0.1' under dependencies. I therefore tried gradle clean which produced this error:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> Could not resolve all dependencies for configuration ':app:_debugApk'.
> A problem occurred configuring project ':react-native-onesignal'.
> Failed to notify project evaluation listener.
> com.android.build.gradle.tasks.factory.AndroidJavaCompile.setDependencyCacheDir(Ljava/io/File;)V
* 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
I had similar problem with Cordova.
I fixed by changing version of gradle from 2.2.3 to 2.3.3.
Below oneliner for this:
sed -i -E 's/com.android.tools.build:gradle:2.2.[0-9]+/com.android.tools.build:gradle:2.3.3/g' build.gradle
I use Ionic 3.4.0 to build android app, when I follow FCM firebase plugin docs
I get error during building android app. I did following:
1 Install plugin:
ionic cordova plugin add cordova-plugin-fcm
npm install --save #ionic-native/fcm
2 Run build android app:
ionic cordova build android
3 I got following error:
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova build android (exit code 1):
ANDROID_HOME=/home/tong/eproject/android
JAVA_HOME=/usr/lib/jvm/java-8-oracle/
Subproject Path: CordovaLib
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
google-services plugin could not detect any version for com.google.android.gms or com.google.firebase, default
version: 9.0.0 will be used.
please apply google-services plugin at the bottom of the build file.
The Task.leftShift(Closure) method has been deprecated and is scheduled to be removed in Gradle 5.0. Please use
Task.doLast(Action) instead.
at
build_6dhr8ioykw4yco44wd3y0fmi8.run(/home/tong/eproject/ionic/MyInoicProject/platforms/android/build.gradle:138)
The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0.
Incremental java compilation is an incubating feature.
The TaskInputs.source(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please
use TaskInputs.file(Object).skipWhenEmpty() instead.
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* 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: 24.847 secs
Error: /home/tong/eproject/ionic/MyInoicProject/platforms/android/gradlew: 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 resolve all dependencies for configuration ':_debugApkCopy'.
> Could not find com.google.firebase:firebase-core:9.0.0.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-core:+ as no versions of
com.google.firebase:firebase-core are available.
Required by:
project :
> Could not find any matches for com.google.firebase:firebase-messaging:+ as no versions of
com.google.firebase:firebase-messaging are available.
Required by:
project :
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
It seems like I am missing com.google.firebase:firebase-core:9.0.0 I read from this post but it does not work when I try to update google services. Please help me thanks.
I have a Ionic/Cordova project, builds for Android are done with Gradle.
I installed all necessary Android SDKs and the project was building fine for many months, but today it fails with the following error:
Running: d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\platforms\android\build.gradle -Dorg.gradle.daemon=true
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.0.0+.
Required by:
BUILD FAILED
Total time: 26.792 secs
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
> Connection to https://repo1.maven.org refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
d:\git\myproject\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\platforms\android\build.gradle -Dorg.gradle.daemon=true"
Error: cmd: Command failed with exit code 1
Cordova command failed with error code 1, aborting!
Clearly, since the project was building just fine for months, everything needed to have it build is already on disk, but the build is probably checking if there are updated version of artifacts in the Maven repo, and this is failing.
This is not a very desired behavior sometimes.
Is it possible to configure the build to always build offline?
So I grepped my repo for com.android.tools.build:gradle and I found it in a few files:
D:\git\myproject\platforms\android\build.gradle\build.gradle
D:\git\myproject\platforms\android\cordova\lib\plugin-build.gradle\plugin-build.gradle
D:\git\myproject\platforms\android\CordovaLib\build.gradle\build.gradle
I changed
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
Hopefully this solves my issue, although the problem is gone now even with 1.0.0+, so I can't really verify that easily.
You can check which exact version of com.android.tools.build:gradle you have available locally in the following folder when on Windows:
$HOME\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle
Hello I'm using latest version of Cordova 6.1.0 and Android SDK Tools.
when I add any admob plugins. the following error message returned after using build command.
A problem occurred configuring root project 'android'
how can I fix this?
BTW please don't send workarounds for Android Studio. I just need to be able to build APK files via cordova and I don't use Android Studio.
Full error details as following:
JAVA_HOME=C:\Program Files (x86)\java\jdk1.7.0_71
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'android'.
Could not resolve all dependencies for configuration ':_debugCompile'.
Could not find any version that matches com.google.android.gms:play-services:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/gms/play-services/maven-metadata.xml
https://repo1.maven.org/maven2/com/google/android/gms/play-services/
Required by:
:android:unspecified
BUILD FAILED
Total time: 11.78 secs
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Error: Error code 1 for command: cmd with args:
/s,/c,"C:\nm\tests\platforms\android\gradlew cdvBuildDebug -b
C:\nm\tests\platforms\android\build.gradle -Dorg.gradle.daemon=true
-Pandroid.useDeprecatedNdk=true"