I made an app with Construct 2 and I exported to Intel XDK. Then I exported to cordova and everytime I try to build with "cordova build android" I get this error:
ERROR: In FontFamilyFont, unable to find attribute android:t
tcIndex
FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':processDebugResources'.
com.android.ide.common.process.ProcessException: Failed to execute aapt
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: 47.337 secs
Command finished with error code 1: cmd /s /c "C:\Users\Gustavo\app\platfo
rms\android\gradlew.bat cdvBuildDebug -b C:\Users\Gustavo\app\platforms\an
droid\build.gradle -Dorg.gradle.daemon=true -Dorg.gradle.jvmargs=-Xmx2048m -Pand
roid.useDeprecatedNdk=true"
Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:fontVariationSettings
ERROR: In <declare-styleable> FontFamilyFont, unable to find attribute android:ttcIndex
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt
It's my first time posting here, so if I am doing something wrong, please tell me.
Thanks for the help!
I got a build successful by adding this in the build-extras.gradle file:
configurations.all {
resolutionStrategy {
force 'com.android.support:support-v4:27.1.0'
}
}
And by installing the cordova-android-support-gradle-release.
Gustavo,
Its is possible that you have a conflict in cordova plugins or platform. A second possiblity is that, you have added components via npm but haven't installed it. For both scenario, I suggest that you list out the current versions installed, note them down then do an update to cordova. Here is how to list out the versions, like what I have.
cd projectfolder
$ cordova plugin
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.1 "Device"
cordova-plugin-whitelist 1.3.3 "Whitelist"
$ cordova platform
Installed platforms:
android 7.0.0
browser 5.0.3
Available platforms:
ios ~4.5.4
osx ~4.0.1
windows ~5.0.0
www ^3.12.0
$ npm -v
3.10.10
Here is how you update cordova for the project. This example assumes you are using android platform. If you have other plugins/platform, do the necessary.
npm install
npm update
cordova platform rm android --nosave
cordova platform add android
Alternatively
cordova platform update android
If you notice a specific plugin with version error, remove and the plugin with required version.
Related
I have an Ionic Cordova app that I have not touched in a few months. I wanted to make a small tweak to the app today and release it but when I did, I started having a dependency issue.
When I try to run 'ionic cordova run android' the build fails. Even without making any changes to the app (revert all changes and try to build what worked for the last APK) it still is failing. I have tried uninstalling the cordova intercom plugin and that changed nothing. I have also tried updating all of my npm packages and that did not help either.
This is the error log I get:
cordova run android
Android Studio project detected
cordova-android-firebase-gradle-release: Android platform: cordova-android#7
cordova-android-firebase-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-play-services-gradle-release: Android platform: cordova-android#7
cordova-android-play-services-gradle-release: No custom version found in config.xml - using plugin default
cordova-android-support-gradle-release: Android platform: cordova-android#7
cordova-android-support-gradle-release: No custom version found in config.xml - using plugin default
Preparing Firebase on Android
ANDROID_HOME=C:\Users\Boogaloo\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_171
studio
Subproject Path: CordovaLib
Subproject Path: app
publishNonDefault is deprecated and has no effect anymore. All variants are now published.
cordova-android-firebase-gradle-release: 15.0.0
cordova-android-play-services-gradle-release: 15.0.0
cordova-android-support-gradle-release: 27.+
Configuration 'compile' in project ':app' is deprecated. Use 'implementation' instead.
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_8vin5yy2zwz3fxyzepqpp0rqu.run(C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\app\build.gradle:151)
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\cordova-plugin-intercom\savings-build-extras-intercom.gradle' line: 71
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:compile'.
Could not find com.google.android.gms:strict-version-matcher-plugin:15.0.0.
Searched in the following locations:
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
Required by:
project :app > com.google.gms:google-services:4.2.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 3s
(node:3432) UnhandledPromiseRejectionWarning: Error: cmd: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
Where:
Script 'C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\cordova-plugin-intercom\savings-build-extras-intercom.gradle' line: 71
What went wrong:
A problem occurred configuring project ':app'.
Could not resolve all dependencies for configuration ':app:compile'.
Could not find com.google.android.gms:strict-version-matcher-plugin:15.0.0.
Searched in the following locations:
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/google/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
file:/C:/Users/Boogaloo/AppData/Local/Android/Sdk/extras/android/m2repository/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://jcenter.bintray.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://maven.google.com/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://repo1.maven.org/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.pom
https://dl.google.com/dl/android/maven2/com/google/android/gms/strict-version-matcher-plugin/15.0.0/strict-version-matcher-plugin-15.0.0.jar
Required by:
project :app > com.google.gms:google-services:4.2.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 3s
at ChildProcess.whenDone (C:\Users\Boogaloo\WebstormProjects\IONIC\projects\myapp\platforms\android\cordova\node_modules\cordova-common\src\superspawn.js:169:23)
at emitTwo (events.js:126:13)
at ChildProcess.emit (events.js:214:7)
at maybeClose (internal/child_process.js:925:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
(node:3432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:3432) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Update
I tried updating the cordova android platform to 7.1.0 but it hasn't helped.
I can't seem to delete the cordova firebase plugin using the command
ionic cordova plugin remove cordova-plugin-firebase
Do you use cordova-plugin-firebase?
If so,
run ionic cordova plugin remove cordova-plugin-firebase and try building again.
If it works, ionic cordova plugin add cordova-plugin-firebase#2.0.5
I am having trouble in building my ionic 3 app. Every time I try to build the android app it gives the following error.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
37 actionable tasks: 10 executed, 27 up-to-date
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 35s
(node:5924) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: cmd: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
Picked up _JAVA_OPTIONS: -Xmx512M
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Get more help at https://help.gradle.org
BUILD FAILED in 35s
Picked up _JAVA_OPTIONS: -Xmx512M
(node:5924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Can anyone help me with the issue?
cordova clean android should fix your problem.
I solved it by removing platform and adding it again:
ionic cordova platform rm android
ionic cordova platform rm ios
ionic cordova platform add android
ionic cordova platform add ios
If the cordova clean command does not solve this problem for you, it might be related to the new implementation of AndroidX in some of your libraries.
In my case it was cordova-plugin-firebase-analytics
Follow these steps:
0 / Remove your android platform
cordova platform rm android
1 / Remove all plugins related to support / gradle / firebase versions control (Optional -- I didn't need to remove any plugins. So if you are not sure about how to do this, just skip this step)
2 / Add the AndroidX plugins from #dpa99c :
# add plugin to enable AndroidX in the project
cordova plugin add cordova-plugin-androidx
# add plugin to patch existing plugin source that uses the Android Support Library to use AndroidX
cordova plugin add cordova-plugin-androidx-adapter
3 / Add your android platform
cordova platform add android
Thanks to #MathieuNa : https://forum.ionicframework.com/t/d8-program-type-already-present/166812/4?u=carlosglegaspi
Delete this folder: "../app/build"
We have a PhoneGap app which refuses to build once we add in PushPlugin.
Specifically when using PhoneGap Build we get the error:
BUILD FAILED
/home/ec2-user/android-sdk/tools/ant/build.xml:573: ../../../../../../home/ec2-user/android-sdk/com.android.support:support-v4:+ resolve to a path with no project.properties file for project /project
We can occasionally get it to build using the Ripple emulator (building in Visual Studio) after updating PhoneGap ($ npm update -g phonegap) and the PhoneGap Android Platform ($ phonegap platform update android) to the latest versions.
We have included the plugin like this:
<gap:plugin name="com.phonegap.plugins.pushplugin" />
Or, when building in Visual Studio 2015:
<vs:plugin name="com.phonegap.plugins.PushPlugin" version="2.5.0" src="https://github.com/phonegap-build/PushPlugin.git" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps" />
Can anyone suggest where we might be going wrong?
EDIT:
We’ve also tried building on the command line, but even after installing cordova-plugin-android-support-v4, thus;
$ cordova plugin add cordova-plugin-android-support-v4
Fetching plugin "cordova-plugin-android-support-v4" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-android-support-v4
npm http 200 https://registry.npmjs.org/cordova-plugin-android-support-v4
Installing "cordova-plugin-android-support-v4" for android
we still get errors:
C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1>cordova build android
Running command: cmd "/s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\build.bat""
ANDROID_HOME=C:\Users\XXX\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\java\jdk1.7.0_55
Running: C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordova
dle.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 ':_debugCompile'.
> Could not find any version that matches com.android.support:support-v4:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/maven-metadata.xml
https://repo1.maven.org/maven2/com/android/support/support-v4/
Required by:
:android:unspecified
* 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: 2.897 secs
C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "C:\Dev\CordovaBlank\BlankCordovaApp1\BlankCordovaApp1\platforms\android\gradlew cdvBuildDebug -b C:\Dev\Cor
latforms\android\build.gradle -Dorg.gradle.daemon=true"
ERROR building one of the platforms: Error: cmd: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1
at ChildProcess.whenDone (C:\Users\XXX\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\cordova\superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
NEW Push Plugin released recently.
Read this (via the Offical Blog), and get the details:
http://simonmacdonald.blogspot.com/2015/07/phonegap-plugin-push-version-111.html
UPDATE (2015-10-24): According to the Phonegap Build blog of Sept 28, 2015
Android Builds Now Using Gradle By Default.
Ant is still available, and can be force into use - with <preference name="android-build-tool" value="ant" />
Other related changes occur, including automatic minSdkVersion versioning and validation of 9-patch images. Read the blog post for details.
NOTE: On your original problem, gradle (not officially supported by phonegap) is the problem. Some people have worked around this problem, by forcing ant to run in it's place. To find those other posts, search back 30 days from this post; the subjects are similar to this and included: "Failed to build".
For PhoneGap Build, use
<gap:plugin name="com.phonegap.plugins.pushplugin" version="2.4.0" /> to force it to use the older, supported, version.
Try removing the plugin and install it via command line using this command:
cordova plugin add com.phonegap.plugins.pushplugin --save
You will notice the plugin will show in your config.xml like this:
<plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />
but it won't show on the config designer, for that to happen, add "vs:" in front of the plugin tag:
<vs:plugin name="com.phonegap.plugins.PushPlugin" spec="^2.2.1" />
Try this (not 100% work, but work for me).
remove this line in platforms/android/project.properties
cordova.system.library.1=com.android.support:support-v4:+
if you are using facebook plugin (like me), you can ignore below.
cordova plugin add android.support.v4
I'm using phonegap 100% from the command line. If I build while connected to the internet it works
$ phonegap build android
[phonegap] executing 'cordova build android'...
[phonegap] completed 'cordova build android'
But if I disconnect from the internet I get errors
$ phonegap build android
[phonegap] executing 'cordova build android'...
cp: no such file or directory: /Users/gregg/src/hft-mobile-app/icon.png
Running command: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build
ANDROID_HOME=/Users/gregg/Downloads/android-sdk-macosx
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/gregg/src/hft-mobile-app/platforms/android/gradlew cdvBuildDebug -b /Users/gregg/src/hft-mobile-app/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:
: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'.
>
repo1.maven.org: nodename nor servname provided, or not known
* 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: 30.753 secs
/Users/gregg/src/hft-mobile-app/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/gregg/src/hft-mobile-app/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/gregg/src/hft-mobile-app/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build: Command failed with exit code 1
You may not have the required environment or OS to build this project
Error: /Users/gregg/src/hft-mobile-app/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
Why is the command line version phoning home? How do I get this to build 100% offline?
Note: I see this error as the 2nd line when trying to build offline
cp: no such file or directory: /Users/gregg/src/hft-mobile-app/icon.png
But as you can see that error does not occur online. Plus supposedly whatever that issue was was fixed according to this
I'm on OSX, I've got the Android SDK installed. I had no idea it was calling home. How do I get it to build offline?
This is what I have experienced till now. Ionic uses gradle for android build. It first time downloads all the dependencies from internet. So internet is most for first gradle build but it caches them and no internet is needed for further build.Since you are having problem why don't you globally update your cordova and ionic.
npm install -g cordova ionic
I am trying to get the basic Cordova v5.0 Android v4.0 project to build on Mac OS X Yosemite, but keep getting this error. Note: The same process builds fine on Cordova v4. I have uninstalled and reinstalled the Android SDK, Cordova, and even Gradle (but I don't think I need it). I've checked that my Path variable contains the correct paths to /tools and /platform_tools. But when I do the 'cordova build' or 'cordova build android' I always get the same error:
Could not create an instance of type
org.gradle.invocation.DefaultGradle_Decorated.
Further down it says:
You may not have the required environment or OS to build this project
What am I missing?
Here's the full text of what I'm doing:
my_acct$cordova create build_test com.example.build_test "BuildTest"
Creating a new cordova project.
my_acct$cd build_test
my_acct$cordova platform add android
Adding android project...
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.example.build_test
Name: BuildTest
Activity: MainActivity
Android target: android-22
Copying template files...
Android project created with cordova-android#4.0.0
Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project
Fetching plugin "cordova-plugin-whitelist#1" via npm
npm http GET https://registry.npmjs.org/cordova-plugin-whitelist
npm http GET https://registry.npmjs.org/cordova-plugin-whitelist
npm http 304 https://registry.npmjs.org/cordova-plugin-whitelist
Installing "cordova-plugin-whitelist" for android
my_acct$cordova build
Running command: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build
ANDROID_HOME=/Users/my_acct/Documents/Development/android-sdk-macosx/sdk
JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Running: /Users/my_acct/Documents/Development/work/build_test/platforms/android/gradlew cdvBuildDebug -b /Users/my_acct/Documents/Development/work/build_test/platforms/android/build.gradle -Dorg.gradle.daemon=true
FAILURE: Build failed with an exception.
* What went wrong:
Could not create an instance of type org.gradle.invocation.DefaultGradle_Decorated.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
/Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/my_acct/Documents/Development/work/build_test/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/my_acct/Documents/Development/work/build_test/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/Users/my_acct/.node/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
If I change to use java 1.7 or 1.8, the error changes to:
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:
:android:unspecified
org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
Here's the full results for using java 1.7 or 1.8:
my_acct$cordova build
Running command: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build
ANDROID_HOME=/Users/my_acct/Documents/Development/android-sdk-macosx/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Running: /Users/my_acct/Documents/Development/work/build_test/platforms/android/gradlew cdvBuildDebug -b /Users/my_acct/Documents/Development/work/build_test/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:
:android:unspecified
> org.slf4j.spi.LocationAwareLogger.log(Lorg/slf4j/Marker;Ljava/lang/String;ILjava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V
* 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.859 secs
/Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/my_acct/Documents/Development/work/build_test/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/my_acct/Documents/Development/work/build_test/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /Users/my_acct/Documents/Development/work/build_test/platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/Users/my_acct/.node/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
I figured it out. I found old, conflicting .jar files in ~/Library/Java/Extensions. Blew away the entire ~/Library/Java directory. Cordova (and Android Studio) runs great now.
The other way how this problem can be resolved is by changing the repository from
mavenCentral()
to
maven{
url 'https://repo1.maven.org/maven2'
}
in both platforms/android/build.gradle and platforms/android/CordovaLib/build.gradle