Android Build error - android

I am doing ionic push notification using FCM during build apk build error came.please help me to solve this issue.
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 ':_debugCompile'.
> Could not find any version that matches com.google.android.gms:play-service
s-gcm:9.8+.
Versions that do not match:
9.4.0
9.2.1
9.2.0
9.0.2
9.0.1
+ 5 more
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
/
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/ma
ven-metadata.xml
https://jcenter.bintray.com/com/google/android/gms/play-services-gcm/
file:/C:/Users/veeravel.p/android-sdks/extras/android/m2repository/com/
google/android/gms/play-services-gcm/maven-metadata.xml
file:/C:/Users/veeravel.p/android-sdks/extras/android/m2repository/com/
google/android/gms/play-services-gcm/
file:/C:/Users/veeravel.p/android-sdks/extras/google/m2repository/com/g
oogle/android/gms/play-services-gcm/maven-metadata.xml
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.

You have to add that in your top-level build file :
dependencies {
...
classpath 'com.google.gms:google-services:3.0.0'
...
}

Related

Build Android Fail when using cordova-plugin-mfp-push

Plugin Version : 8.0.2021062405
When ever i run ionic cordova build android with cordova-plugin-mfp-push plguin installed i am getting the below error mentioned.
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\anis.khalfaoui\Desktop\ProxymProjects\kgoc-frontend\platforms\android\app\build.gradle' line: 102
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all artifacts for configuration 'classpath'.
> Could not resolve com.android.tools.build:gradle:+.
Required by:
unspecified:unspecified:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://dl.bintray.com/kotlin/kotlin-eap/com/android/tools/build/gradle/maven-metadata.xml. > Could not get resource 'https://dl.bintray.com/kotlin/kotlin-eap/com/android/tools/build/gradle/maven-metadata.xml'.
> Could not GET 'https://dl.bintray.com/kotlin/kotlin-eap/com/android/tools/build/gradle/maven-metadata.xml'. Received status code 502 from server: Bad Gateway
* 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 15s
C:\Users\anis.khalfaoui\Desktop\ProxymProjects\kgoc-frontend\platforms\android\gradlew: Command failed with exit code 1 Error output:
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
this is the line 102 in Build file 'C:\Users\anis.khalfaoui\Desktop\ProxymProjects\kgoc-frontend\platforms\android\app\build.gradle'
apply from: "../cordova-plugin-mfp-push/ibm-build-extras.gradle"
As you see in error message, you have provided + for com.android.tools.build:gradle version in build.gradle file.
Please provide complete version like com.android.tools.build:gradle:4.0.0.
That should resolve your issue.
Thanks

FAILURE: Build failed with an exception React-native

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-linear-gradient'.
Could not resolve all dependencies for configuration ':react-native-linear-gradient:_debugCompileCopy'.
Could not find com.android.support:appcompat-v7:26.1.0.
Searched in the following locations:
file:/Users/omkaryadav/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.pom
file:/Users/omkaryadav/Library/Android/sdk/extras/android/m2repository/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar
file:/Users/omkaryadav/Documents/project/react/Archive/android/sdk-manager/com/android/support/appcompat-v7/26.1.0/appcompat-v7-26.1.0.jar
Required by:
project :react-native-linear-gradient > com.facebook.react:react-native:0.56.0
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: 13.577 secs
You have to link 3rd party libraries before building your project. That specific library you can link automatically by running react-native link.
If you didn't already, run npm install before command above.

cordova don'd build to android

I'm new at Cordova and I'm trying to solve this for two days.
When I hit the command: Cordova run android --device this shows up:
C:\Users\Arthur\nameoftheapp>cordova run android --device
ANDROID_HOME=C:\Users\Arthur\Downloads\Aprender\adt-bundle-windows-x86_64-201407
02\adt-bundle-windows-x86_64-20140702\sdk
JAVA_HOME=C:\Program Files\Java\jdk1.8.0_172
Subproject Path: CordovaLib
Incremental java compilation is an incubating feature.
BUILD FAILED
Total time: 7.354 secs
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.android.support:appcompat-v7:27.0.0.
Required by:
:android:unspecified
Could not find com.android.support:support-v4:27.0.0.
Required by:
:android:unspecified
Could not find com.android.support:support-v4:27.0.0.
Required by:
:android:unspecified > com.google.android.gms:play-services-gcm:9.8.0 >
com.google.android.gms:play-services-basement:9.8.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 ':_debugApkCopy'.
Could not find com.android.support:appcompat-v7:27.0.0.
Required by:
:android:unspecified
Could not find com.android.support:support-v4:27.0.0.
Required by:
:android:unspecified
Could not find com.android.support:support-v4:27.0.0.
Required by:
:android:unspecified > com.google.android.gms:play-services-gcm:9.8.0 >
com.google.android.gms:play-services-basement:9.8.0
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
I tried to change the version in the build.gradle to another but when I compile, it changes back.
Do you used many cordova plugin with you'r application ?
if yes you can handle this with this plugin : https://github.com/dpa99c/cordova-android-support-gradle-release

New dependency React native - gradle clean - could not resolve all dependencies

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

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

Categories

Resources