Cordova error building after adding plugin - android

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"

Related

Could not find com.android.support:appcompat-v7:27.1.1 | react-native-vector-icons

I was trying to compile location-saver that has a dependency react-native-vector-icons that I was not able to build.
The build was failing after a lot of attempts. Here is the log:
react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> A problem occurred configuring project ':react-native-vector-icons'.
> Could not resolve all dependencies for configuration ':react-native-vector-icons:_debugCompile'.
> Could not find com.android.support:appcompat-v7:27.1.1.
Searched in the following locations:
file:/Users/gureks/.m2/repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/.m2/repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Desktop/Github/reacting/location-saver/node_modules/react-native/android/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Desktop/Github/reacting/location-saver/node_modules/react-native/android/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
https://repo1.maven.org/maven2/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
file:/Users/gureks/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.pom
file:/Users/gureks/Library/Android/sdk/extras/google/m2repository/com/android/support/appcompat-v7/27.1.1/appcompat-v7-27.1.1.jar
Required by:
LocationSaver:react-native-vector-icons:unspecified > com.facebook.react:react-native:0.57.8
* 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: 16.274 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/getting-started.html
I even changed the Support Library versions in the build.grade of the react-native-vector node_module.
Need help for a project, new to react-native.

Ionic Android Application not building

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.

Cordova build android exception

I'm trying to build an Android application with cordova, when i launch:
cordova build android
an error occurred, and i don't understand how to solve this problem.
If i build my project with Android Studio the gradle is fixed by the IDE, but if i try to compile with cordova command line i have the error that i indicated.
How i can solve ? I need to use command line not Android Studio.
ANDROID_HOME=E:\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_91
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\MY\Desktop\testSpeedTest\platforms\android\build.gradle' line: 22
* What went wrong:
A problem occurred evaluating root project 'android'.
> Failed to apply plugin [id 'android']
> Gradle version 2.10 is required. Current version is 2.2.1. If using the gradle wrapper, try editing the distributionUrl in C:\Users\MY\Desktop\testSpeedTest\gradle\wrapper\gradle-wrapper.properties to gradle-2.10-all.zip
* 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.777 secs
Error: Error code 1 for command: cmd with args: /s,/c,"C:\Users\MY\Desktop\testSpeedTest\platforms\android\gradlew cdvBuildDebug -b C:\Users\MY\Desktop\testSpeedTest\platforms\android\build.gradle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"

IONIC Build error

When I am running the ionic build android command I am getting the below error.
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-met
adata.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: 11.915 secs
Error: Error code 1 for command: cmd with args: /s,/c,"D:\morrison\myApp\platfor
ms\android\gradlew cdvBuildDebug -b D:\morrison\myApp\platforms\android\build.gr
adle -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
I have checked the sdk and the android support seems to be installed. Please let me know how I can resolve this issue
you should open sdk manager and you can see Google Repository under the Extras folder

Cordova not able to build with cordova-plugin-local-notifications

I have added notification plugin using this command:
cordova plugin add https://github.com/katzer/cordova-plugin-local-notifications.git
However when I build the App, it fails with below error.
> cordova build android --release
ANDROID_HOME=E:\Android\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_31
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: 4.119 secs
Error: Error code 1 for command: cmd with args: /s,/c,"E:\PhoneGap\MyApp\platforms\android\gradlew
cdvBuildRelease -b E:\PhoneGap\MyApp\platforms\android\build.gradle
-Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
I have the similar issue, and I achieved a workarround. After creating the platform, open the platform/android folder with android Studio
In the project left tab, left click in android, and select "Open Module Settings"
Go to "Dependencies" Tab, click "+" and "Library Dependency"
Select the "support v4" and click "OK"
Now you can build it.
Also, it could be achieved adding
<framework src="com.android.support:support-v4:+" />
To your config.xml, but it didn't worked for me
Also you have more info here:
https://github.com/phonegap-build/PushPlugin/issues/492
Maybe this helps you.
Please, post your results
Taking cue from #Del I installed the following extra's and the build was successful. I am using Cordova 6.1.1

Categories

Resources