Trying to build my first app using ionic.
I have added phonegap-plugin-push may be something went amiss here and unable to figure it out. Tried updating the android SDK, installing and reinstalling. Project was initiated only with ionic start appName
I did not mention any bundle identifier while initiating the project. I just did ionic platform add android to add android to the project.
Pasting the log below while running ionic build android.
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-gcm:+.
Searched in the following locations:
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/maven-metadata.xml
https://repo1.maven.org/maven2/com/google/android/gms/play-services-gcm/
file:/Users/Yashwanth/NVPACK/android-sdk-macosx/extras/android/m2repository/com/google/android/gms/play-services-gcm/maven-metadata.xml
file:/Users/Yashwanth/NVPACK/android-sdk-macosx/extras/android/m2repository/com/google/android/gms/play-services-gcm/
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: 3.125 secs
/Users/Yashwanth/appName/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /Users/Yashwanth/appName/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/Yashwanth/appName/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /Users/Yashwanth/appName/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/Yashwanth/appName/platforms/android/cordova/build: Command failed with exit code 1
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at emitTwo (events.js:87:13)
at ChildProcess.emit (events.js:172:7)
at maybeClose (internal/child_process.js:817:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
The issue seems to be something related to configuring push. Please help me with a solution.
Adding the Google Repository on the Android SDK manager fixed it.
Related
I used Visual Studio Code App Center for Building my android apps, It was ok after but now build failed with below exception. How can I fix this issue?
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/runner/work/1/s/app/build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
> Android Gradle plugin requires Java 11 to run. You are currently using Java 1.8.
You can try some of the following options:
- changing the IDE settings.
- changing the JAVA_HOME environment variable.
- changing `org.gradle.java.home` in `gradle.properties`.
* 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 45s
Error: /Users/runner/work/1/s/gradlew failed with return code: 1
at ChildProcess.<anonymous> (/Users/runner/work/_tasks/Gradle_8d8eebd8-2b94-4c97-85af-839254cc6da4/1.128.0/node_modules/vsts-task-lib/toolrunner.js:569:30)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:920:16)
at Socket.<anonymous> (internal/child_process.js:351:11)
at emitOne (events.js:96:13)
at Socket.emit (events.js:188:7)
at Pipe._handle.close [as _onclose] (net.js:509:12)
##[error]Error: /Users/runner/work/1/s/gradlew failed with return code: 1
If you are using Visual Studio Code App Center, you may face the same kind of issue when you use JAVA 11 in your android project. If you are looking a solution for MS App Center issue, This may help you!
Go to https://appcenter.ms/users/user1/apps/yourapp/build/branches
Click settings icon to go to Build configuration
Scroll down to Environment and turn on.
Set JAVA_HOME to $(JAVA_HOME_11_X64)
From one day to another my build is now failing and these are the logs I have got from phonegap build:
Total time: 2.61 secs
Subproject Path: CordovaLib
"plugman-151 install --platform android --project /project --plugin cordova-plugin-splashscreen --nohooks=.": Fetching plugin "cordova-plugin-splashscreen" via npm
Installing "cordova-plugin-splashscreen" at "5.0.2" for android
Subproject Path: CordovaLib
null
FAILURE: Build failed with an exception.
* Where:
Build file '/project/build.gradle' line: 253
* What went wrong:
A problem occurred evaluating root project 'project'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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: 0.853 secs
Failed to install 'cordova-plugin-splashscreen': Error: /project/gradlew: Command failed with exit code 1
at ChildProcess.whenDone (/project/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
/project/gradlew: Command failed with exit code 1
I thought there was a problem with the splashscreen plugin so I downgrade it and then removed it but then the builds keeps failing complaining about another plugin with basically the same error.
I don't know much about the Gradle file and from my understanding PhoneGap Build takes care of it or at least it should handle it.
I am using Phonegap-cli 6.4 and the build is for Android.
Please guys let me know if you need further info to help and THANKS a lot :)
UPDATE: The only way to get a successful build is removing all the plugins from the config.xml :'( :'( :'(...and now? Still trying to figure out another way to add the plugins then.
UPDATE 2: These are the logs if I use Phonegap-Cli 7.0.1
--------------------------------------------------------------------------------
COMPILE OUTPUT
--------------------------------------------------------------------------------
:wrapper
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
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_3165fehnqtadtl3m714hg3us5.run(/build.gradle:138)
FAILURE: Build failed with an exception.
* Where:
Build file '/build.gradle' line: 253
* What went wrong:
A problem occurred evaluating root project 'www_android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* 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.08 secs
Error: /gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* Where:
Build file '/build.gradle' line: 253
* What went wrong:
A problem occurred evaluating root project 'www_android'.
> Could not get unknown property 'GMS_VERSION' for object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
at ChildProcess.whenDone (/cordova/node_modules/cordova-common/src/superspawn.js:169:23)
at emitTwo (events.js:106:13)
at ChildProcess.emit (events.js:191:7)
at maybeClose (internal/child_process.js:877:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
Similar error - no clue whats going on
I got a a successful build deleting this line in my config.xml
<plugin name="cordova-plugin-google-analytics" source="npm" />
Maybe there is a problem with this plugin...
good luck!
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"
I tried to build an existing android-phonegap file using "phonegap build android", it failed and showed some errors. But, I have built a new android-phonegap file successfully using the same command. Why does it not build the existing file? I have searched some answers online, those didn't work. I have changed minsdkversion and targetsdkversion in Androidmainfest.xml and build.grade, this still didn't work.
Here are the errors:
:processDebugManifest
/Users/zhangxu/Desktop/Rouse Services Modified/rmpa/platforms/android/AndroidManifest.xml:15:13 Error:
Missing one of the key attributes 'action#name,category#name' on element intent-filter at AndroidManifest.xml:15:13
/Users/zachary/Desktop/phohegapProject/platforms/android/AndroidManifest.xml:0:0
Error:
Validation failed, exiting
FAILED
FAILURE:
Build failed with an exception.
* What went wrong:
Execution failed for task ':processDebugManifest'.
Manifest merger failed with multiple errors, see logs
* 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.064 secs
/Users/zachary/desktop/phonegapProject/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command:
/Users/zachary/desktop/phonegapProject/platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/zachary/desktop/phonegapProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error:
/Users/zachary/desktop/phonegapProject/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/zachary/desktop/phonegapProject/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: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)
I reinstalled the plugin:
com.synconset.imagepicker
and this seems to have fixed the issue.
Can you try uninstalling the platform and installing it again ?
I know is a late answer, but this maybe help someone else with the issue.
when building with build.phonegap add this to your config.xml:
<plugin name="com.synconset.imagepicker" spec="https://github.com/wymsee/cordova-imagePicker.git"/>
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