Build failed on run-android due to dependencies - android

Problem while running the run-android. I was facing a problem, I guess it's dude to the gradle dependencies.
I have even tried sudo, which is giving some other random error saying $ANDROID_HOME. Which isn't the problem.
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'.
> Could not resolve all dependencies for configuration ':app:_debugCompile'.
> Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
Required by:
AwesomeProject:app:unspecified
> Could not find com.android.support:appcompat-v7:23.0.0.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
file:/Users/iraycd/.m2/repository/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.pom
https://jcenter.bintray.com/com/android/support/appcompat-v7/23.0.0/appcompat-v7-23.0.0.jar
Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0
> Could not find com.android.support:support-v4:21.0.3.
Searched in the following locations:
file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
file:/Users/iraycd/.m2/repository/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.pom
https://jcenter.bintray.com/com/android/support/support-v4/21.0.3/support-v4-21.0.3.jar
Required by:
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:drawee:0.6.1
AwesomeProject:app:unspecified > com.facebook.react:react-native:0.11.0 > com.facebook.fresco:fresco:0.6.1 > com.facebook.fresco:imagepipeline:0.6.1
* 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.247 secs
Could not install the app on the device, see the error above.
Where did I go wrong?

Android Support Repository was missing installed, again followed all the steps here: https://facebook.github.io/react-native/docs/android-setup.html
https://github.com/facebook/react-native/issues/2772#issuecomment-140843907

In case, like me, nothing else you've read has worked, this worked for me:
Check in the latest snapshot of changes to your source control
Remove the project directory from your system
Check out your code from source control
npm cache clean && npm install
watchman watch-del-all
react-native start -- --reset-cache
react-native run-android
:mind-blown:

Doesn't look like you've updated your libs on your machine to the newest version. Download the new versions of the support library/appcompat and then try again

It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.

For those encountering this problem when they attempt to simply use the Android SDK Manager (tools/android), I had to run the SDK manager as root (e.g. sudo ./tools/android) to get around this error.
Unfortunately, running an X11-forwarded program as root can sometimes bring about its own issues. If you encounter problems trying to run the SDK manager as root, see this answer here. Specifically, I was able to run the SDK manager as my normal user, but attempting to run as root always failed.

It looks like you don't have android sdk installed and/or the path to it is not set up properly. There are detailed instructions about how to do this in the android setup docs of react native, follow the instructions for Install and configure SDK.

Related

Android Execution failed for task ':app:compileDebugJavaWithJavac'. - React Native

I am working on a react native application. when I try to build the applications using react-native run-android the build fails. Here is the output of the error that occurs.
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* 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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 8s
253 actionable tasks: 5 executed, 248 up-to-date
error 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
error Command failed: ./gradlew app:installDebug
debug Error: Command failed: ./gradlew app:installDebug
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runOnAllDevices.js:58:39)
at buildAndRun (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:142:41)
at then.result (/Users/FaisalHussain/mobile/node_modules/#react-native-community/cli/build/commands/runAndroid/runAndroid.js:104:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7)
The application was on a old version of react native (0.48.x) I have updated it to 0.59.10.
What I have done so far:
used jetifier to resolve issues with the plugins.
checked that the build tools version matches the compile sdk version
checked if the emulator is running.
Hence I have tried everything I could to resolve this but had no luck. Please do guide me on how to resolve this issue. Looking forward to your answers.
make sure you have followed all the necessary steps from the upgrade helper https://react-native-community.github.io/upgrade-helper/?from=0.48.0&to=0.59.10
also i would suggest you to upgrade to v0.60+ because there are breaking changes after v0.59.10.
having said that
before you run the app make sure your gradle is clean
run the following command to clean your gradle cd android && ./gradle clean
then later you can navigate back to your app folder cd .. and try and run again react-native run-android
Looks like your packages not working stable with Android side. It's better be update all packages and react native version to their last stable versions.
If you face with too much error while update, you can create fresh new react native project (with same package name with your current project), install all packages (and their dependencies) and copy your current project's source code to your new project.
Android in React Native does not allow similar packages to reside in the project.
In my case I had react-native-cookies and #react-native-cookies/cookies packages that add similar code to the Kotlin file upon build. This causes issue of similar imports in java JDK.
I removed one and it worked.
SOLVED at the same issue:
My solution was at /android/build.gradle file.
Somehow, the buildscript versions were wrong.
Follow the exact same step of RN documentation and make a totally new & clean project.
And compate the /android/build.gradle file > buildscript & dependencies part.
There should be some version differences.
It matters by your own local env settings.
After changing buildToolsVersion, ndkVersion, classpath, it worked fine again!!
also, remove duplicated libraries, as #Nimantha said.

Ionic2 and Facebook Login: Errors in emulating android device after installing cordova-plugin-facebook4

I have an Ionic2 app that I was hoping to install cordova-plugin-facebook4 with and setup Facebook Login. I've followed a few tutorials like this one here but I am running into issues when I try to emulate an android build.
Here is the error message:
Error: /Users/mreiter/documents/photor/photor/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 ':_debugCompile'.
> Could not find com.android.support:support-v4:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
https://jcenter.bintray.com/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/support-v4/23.4.0/support-v4-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
> Could not find com.android.support:cardview-v7:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
https://jcenter.bintray.com/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/cardview-v7/23.4.0/cardview-v7-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
> Could not find com.android.support:customtabs:23.4.0.
Searched in the following locations:
https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
https://repo1.maven.org/maven2/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
https://jcenter.bintray.com/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/android/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.pom
file:/Users/mreiter/Library/Android/sdk/extras/google/m2repository/com/android/support/customtabs/23.4.0/customtabs-23.4.0.jar
Required by:
:android:unspecified
:android:unspecified > com.facebook.android:facebook-android-sdk:4.14.1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
Any help with this would be greatly appreciated.
I was experiencing this issue this morning. The following steps worked for me:
Started a clean Ionic 2 project
Added android platform & installed the ionic facebook wrapper as described in the docs.
Opened Android Studio, imported the project from platforms/android/
Let it load, but when it asks you to update Gradle select ignore for this project.
After that it'll 'strongly recommend' you to update Gradle, once again ignore it and it'll Android Studio will start running your Gradle and building out an APK.
You'll find that you can use ionic build android and it should work.
Also I removed all Android SDK's except Android 6.X.X (Marshmallow). Give it a try. Still not exactly sure what the issue was though.

React Native: Could not resolve all dependencies for configuration

I just started with React native.
I've follow this article: https://facebook.github.io/react-native/docs/getting-started.html
I run my application with command: react-native run-android but it show an exception:
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project
Could not resolve all dependencies for co
Could not resolve com.android.tools.bu
Required by:
:abcdefgg:unspecified
Could not resolve com.android.tools
Could not get resource 'https:// /build/gradle/1.3.1/gradle-1.3.1.pom'.
Could not GET 'https://jcente /gradle/1.3.1/gradle-1.3.1.pom'.
Connection to https://jcen
Try: Run with --stacktrace option to get the sta option to get more log output.
BUILD FAILED
How can i resolve this problem? I've read many articles here, Local Maven repository for Support Library has been installed in my computer.
Thanks very much!
I just solve this problem this morning.
If you noticed there is a list of dependencies map defined in settings.gradle inside android folder.
Here is what I did:
Go to android folder
Run this command ./gradlew installDebug --info
And then it will show a list of dependencies that android need. It also show which dependencies are not resolved.
In my case I'm lack of 'react-native-network-info' so all I need to do is npm install that package.
Maybe your situation will difference but I think this can help you.
In react-native this problem is due to flipper dependencies, it is solved by increasing its version to 0.105.0. (file: gradle.properties)

Error build Android in Cordova: Unspecified required by?

I'm trying to build my app in Cordova 5.4 using cordova run android. I'm getting this:
* 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
I can't seem to track this one down. Look familiar?
Sorry, if this should be a comment but I don't have enough points yet to do so.
Please try to install Android Support Repository in the Android SDK Manager.
Then check whether this works
cordova build android --verbose
If it's successful,
cordova run android --verbose
Source:
https://github.com/AzureAD/azure-activedirectory-library-for-cordova/issues/6
Check for android-support-v4.jar in your project build path.

Could not resolve all dependencies for configuration ':_armv7DebugCompile'

The following error occurs when trying to build an android app with cordova and the cordova-crosswalk plugin:
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'android'.
> Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
> 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/
https://download.01.org/crosswalk/releases/crosswalk/android/maven2/com/android/support/support-v4/maven-metadata.xml
https://download.01.org/crosswalk/releases/crosswalk/android/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.918 secs
/home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/gradlew with args: cdvBuildDebug,-b,/home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/build.gradle,-PcdvBuildArch=arm,-Dorg.gradle.daemon=true
ERROR running one or more of the platforms: Error: /home/remi/dev/git/gitlab/sirap-sas/tereo-mobile/platforms/android/cordova/run: Command failed with exit code 1
You may not have the required environment or OS to run this project
Please notice that section:
Could not resolve all dependencies for configuration ':_armv7DebugCompile'.
It can happen because building an android project with the crosswalk plugin try to build two apks : one for ARM, the other for x86.
The solution is to install Android Support Repository :
Open the SDK manager (from command line, type android).
Under Extras, Make sure you have Android Support Repository and Google Repository downloaded.
Update answer
Seems starting from crosswalk 16, Android Support Repository and Google Repository is not enough.
You need to install Local Maven repository for Support Libraries from Extras as well.
for me Solution was:
i updated crosswalk to #15.44.384.13
ionic browser add crosswalk#15.44.384.13
then i changed config.xml:
<preference name="xwalkVersion" value="15+" />
cuz versions "16+" - "18+" not work for me
It may be the problem when you did not include google support respository and android support repository under extras. as well as when you not update the cordova with your cordova platform.because cordova and cordova platform must be use latest version.update your Cordova with npm update cordova -g --save and cordova platform with cordova platform update platform_name(like android).
This worked for me
1.goto platforms\android\cordova-plugin-crosswalk-webview folder
2.Open .gradle file
3.find
dependencies { compile xwalkSpec }
and replace with
dependencies {
compile 'org.xwalk:xwalk_core_library:22.52.561.4'
}
**
note: 22.52.561.4 is version of crasswalk on your machine
to know it , open ionic app , chrome://inspect then
window.navigator.userAgent
This will print some lines , copy xwalk details from there
I know it's a little late to add an answer. but I faced this issue for a long time and none of these steps fixed it. If your IP is from Iran, then you should build your project with VPN on. It seems that dependencies are banned for some countries.

Categories

Resources