React Native: Could not resolve all dependencies for configuration - android

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)

Related

Flutter Android build not generating in Mac

In Mac, I've setup Flutter in Android studio. When I'm running project it gives me error
* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
I'm using all latest versions of Flutter, Kotlin, Gradle etc.
You need to equalize kotlin version in first row which is ext.kotlin_version = '1.6.10' to according to classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" of underlined $kotlin_version
After this, the problem will solve...
Actually I found a solution for my problem. There are 2 dependency defined in .yaml file 1. geo_location and 2. location.
After removing the location dependency from .yaml file and run command flutter pub get I can successfully build android build from Mac. This solution might not be global but solution of my problem I found this.
Thank you!
Happy coding.

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.

gradle error in android build react native

[x] submitting bug
[x] Android platform react-native
[x] ubuntu 16.04 LTS
I am having issue in creating build by command react-native run-android
Here i am pasted error:
$ react-native run-android Scanning folders for symlinks in
/home/pct3/webroot/Hello/node_modules (39ms) 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 root project 'Hello'.
Could not resolve all files for configuration ':classpath'.
Could not resolve com.android.tools.build:gradle:3.0.1.
Required by:
project :
Could not resolve com.android.tools.build:gradle:3.0.1.
Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.0.1/gradle-3.0.1.pom'.
sun.security.validator.ValidatorException: No trusted certificate found
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 12s 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
Your help will save my day, if you need any extra information let me know.
Github link: Issue
a fast and easy solution to this issue is as following
1- open android/build.gradle
2-replace the gradle version with an older one for example 3.0.1
example of how it should look
classpath("com.android.tools.build:gradle:3.0.1")
and boom no more issues
Delete or rename the android folder and run react-native upgrade command.
Run npm install
Change your build.gradle so it follows this format:
You can see all available artifacts at Google's Maven repository index (see below for programmatic access).
To add one of these libraries to your build, include Google's Maven repository in your top-level build.gradle file:
allprojects {
repositories {
google()
// If you're using a version of Gradle lower than 4.1, you must instead use:
// maven {
// url 'https://maven.google.com'
// }
// An alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
More info here https://developer.android.com/studio/build/dependencies

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.

Build failed on run-android due to dependencies

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.

Categories

Resources