Could not determine the dependencies of task ':app:mergeDebugAssets' - android

When I run react-native run-android on my project,I get an build error of gradle. I already uninstalled react-native-ftp with npm uninstall --save react-native-ftp, removed that dependency of node_modules, clear ./gradle cached files. But the error continuous..
In my environment windows this project works normally.
What's happing?
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:mergeDebugAssets'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve project :react-native-ftp.
Required by:
project :app
> Unable to find a matching configuration of project :react-native-ftp:
- None of the consumable configurations have attributes.
* 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 2s
at makeError (/home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:174:9)
at /home/leroto/leroto-workspace/svm/frontend/node_modules/execa/index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (/home/leroto/leroto-workspace/svm/frontend/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:5)
at async Command.handleAction (/home/leroto/leroto-workspace/svm/frontend/node_modules/react-native/node_modules/#react-native-community/cli/build/index.js:186:9)

Go to your project level android directory and run ./gradlew clean
If the problem persists, delete node_modules folder and npm install
or you can do this manually:
npm list and then resolve all UNMET DEPENDENCY issues

Step1: Check whether all your "SDK Platforms" and "SDK Tools" is installed and Updated"
Step2: Create "local.properties" file in android folder and paste the following
sdk.dir = /Users/USERNAME/Library/Android/sdk
THIS SHOULD SOLVE YOUR PROBLEMS

I got this at react-native-udp
go into
nodemodules/react-native-udp/android/build.gradle
and replace
implementation 'com.facebook.react:react-native:0.11.+'
with
implementation 'com.facebook.react:react-native:0.70.4'
changing the module name to the module where this occurred and the version number to your current react version

first
click on android folder
click on settings.gradle file
remove this
include ':react-native-ftp'
project(':react-native-ftp').projectDir = new
File(rootProject.projectDir,
'../node_modules/react-native-ftp/android')
second
click on android folder
click on app folder
click on build.gradle file and remove
implementation project(':react-native-ftp')

Related

npx react-native run-android does not work - "java.io.IOException: The filename, directory name, or volume label syntax is incorrect"

Just recently ejected expo and I'm trying to run my app on an android device. I followed the instructions (hopefuly right) but I keep getting this error when I try to run my app:
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.0.1/userguide/command_line_interface.html#sec:command_line_warnings
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> java.io.IOException: The filename, directory name, or volume label syntax is incorrect
* 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 3s
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':app'.
> java.io.IOException: The filename, directory name, or volume label syntax is incorrect
* 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 3s
at makeError (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:174:9)
at C:\Users\User\Documents\jad for eject\jad\jad\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (C:\Users\User\Documents\jad for eject\jad\jad\node_modules\#react-native-community\cli\build\index.js:186:9)
Thanks for the help!
I had the same issue on Windows, and my problem was with the Gradle local.properties file.
It contained the following:
org.gradle.java.home=C:\Program Files\Java\jdk-15.0.1
sdk.dir=C:\Users\user\AppData\Local\Android\Sdk
The problem was probably the windows backslash (\). What worked is escaping it:
org.gradle.java.home="C:\\Program Files\\Java\\jdk-15.0.1"
sdk.dir=C:\\Users\\user\\AppData\\Local\\Android\\Sdk
I struggled with this issue for 3 hours but nothing worked.
I managed to solve my issue by removing the quote in the local.properties file :
sdk.dir = "C:\\Users\\<USER>\\AppData\\Local\\Android\\Sdk"
To
sdk.dir = C:\\Users\\<USER>\\AppData\\Local\\Android\\Sdk
I was able to solve the issue by changing
sdk.dir = C:\Users\mob\AppData\Local\Android\Sdk
to
sdk.dir = C:\\Users\\mob\\AppData\\Local\\Android\\Sdk
I Solved the issues by below setting:
Adding the following commands at end in my android > gradlew script:
yes | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-28"
yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.3"
And Under android > gradle > wrapper > gradle-wrapper.properties change
distributionUrl=https://services.gradle.org/distributions/gradle-6.{any}-all.zip
to
distributionUrl=https://services.gradle.org/distributions/gradle-6.3-all.zip
And also check node version if node v12 or above then update JDK v{any} to JDK v14.
Also in android > build.gradle change
buildToolsVersion: {any} to buildToolsVersion: 28.0.3
And before changing buildToolsVersion check whether you have installed v28.0.3 or not. If not then no problem the above two commands install it automatically.
and the last thing is to check whether you have the local.properties file or not. If it is present under android folder then check your sdk path is correct. And if it is not present then under android folder create a new file named local.properties and under that file write the following command:
sdk.dir=Your SDK folder path
Hopefully, after the following setting you are good to go to run npx react-native run-android
This Worked for me!
i had similar issues on my react native project but i fix then using the following steps on windows users:
Delete your node_modulues and reinstall it
check or increase your grade distributionUrl to 6.+
create or your local.properties to match this sdk.dir=C:\\Users\\USER\\AppData\\Local\\Android\\sdk
add the following under your gradew
yes | $ANDROID_HOME/tools/bin/sdkmanager "platforms;android-28"
yes | $ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.3"
First of all, understand that the JavaIOException occurs when the java could not file the directory or any file it is looking for. So, in your case the gradlew is looking for the SDK and it is not finding it.
To resolve this issue, check build.gradle for this:
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
As, you see the buildToolsVersion = "28.0.3". This name should be under your $SDK_DIR/build-tools/ by the folder named 28.0.3. If your buildToolsVersion and the name of the folder is mismatched it throws JavaIOException. So, change the buildToolsVersion as you require from here.
If this does not work, try restarting your PC.
Ive just remove both of these lines from gradle local.properties
org.gradle.java.home="C:\\Program Files\\Java\\jdk-19"
sdk.dir = "D:\\Android_SDK"
and then added this enviroment variable to my system :
ANDROID_SDK_ROOT -> "Path of my installed SDK". like this :

Build failed with fresh installed react-native app

Im trying to build an app but run into some problems so tried with a fresh projects that still fails to build. This is my steps:
1) Installing the app with
react-native init Myapp
after that Im running the emulator in android studio and launching the app with:
react-native run-android
and are getting the errormessage below. I have tried to reinstall the react-native cli
npm install -g react-native-cli
reset the cache in gradle with
cd android
gradlew cleanBuildCache
It used to work but since I have had some problems to build the apk I messed around a bit with the gradle. I might have updated something that causes the error. Any help is very welcomed!
here is the errormessage
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve org.webkit:android-jsc:+.
Required by:
project :app
> Failed to list versions for org.webkit:android-jsc.
> Could not list versions using M2 pattern 'https://jitpack.io/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jitpack.io/org/webkit/android-jsc/'.
> Could not GET 'https://jitpack.io/org/webkit/android-jsc/'. Received status code 522 from server: Origin Connection Time-out
* 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 39s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose
flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':app:preDebugBuild'.
> Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
> Could not resolve org.webkit:android-jsc:+.
Required by:
project :app
> Failed to list versions for org.webkit:android-jsc.
> Could not list versions using M2 pattern 'https://jitpack.io/[organisation]/[module]/[revision]/[artifact]-[revision](-[classifier])(.[ext])'.
> Could not get resource 'https://jitpack.io/org/webkit/android-jsc/'.
> Could not GET 'https://jitpack.io/org/webkit/android-jsc/'. Received status code 522 from server: Origin Connection Time-out
* 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 39s
at checkExecSyncError (child_process.js:616:11)
at execFileSync (child_process.js:634:13)
at runOnAllDevices (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at then.result (D:\Myapp\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
Is Android SDK installed and are all the required variables set?
Try running in the command line:
adb
If the command is not recognized, then something is wrong with your Android SDK installation.
Follow the link provided in the error for detailed instructions on installing Android SDK.
I think, Developer options closed in your devices first open developer options,
then try this command
react-native init Test
npm i
react-native run-android or ios.
Turn off wifi
Build the app in offline mode
Turn on wifi
Your app should be builded
The reason behind this has been described here: https://github.com/react-native-camera/react-native-camera/issues/2490
Go to android folder and edit build.gradle
set buildToolsVersion to buildToolsVersion = "23.0.1" mine was 30.0.2 when i changed it to "23.0.1" it started working
In the android folder run
gradlew.bat installDebug
and make sure the Build is successful
That should do it go back to your project folder and run
npm run android

Gradle error while trying to build android application using Cordova

I use cordova to build android apps:
$ cordova build android
I got an error:
Error: Could not find an installed version of Gradle either in Android
Studio, or on your system to install the gradle wrapper. Please include
gradle in your path, or install Android Studio
Then I tried install gradle:
$ sudo apt install gradle
And then I'm struggling with this one:
aqil#dell:~/hello$ cordova build
ANDROID_HOME=/home/aqil/Android/Sdk
JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
/usr/lib/jvm/java-8-openjdk-amd64/bin/java: symbol lookup error: /usr/lib/jni/libnative-platform-curses.so: undefined symbol: tgetent
Error: /usr/share/gradle/bin/gradle: Command failed with exit code 127
This worked for me:
Remove Gradle sudo apt-get remove gradle
Add this to your .bashrc file: export PATH=${PATH}:/opt/android-studio/gradle/gradle-X.XX.X/bin (Where X.XX.X is the version under this path.)
Now cordova build android should work without errors.
I finally could solve the issue. It was something wrong with the gradle. First step: removing it.
$ sudo apt remove gradle
Then i downloaded it manually from the link below
gradle-3.5.zip
Extract then add it's path into the environment using the command below:
$ sudo gedit ~/.bashrc
Add these two path at the bottom of the file:
export GRADLE_HOME=/home/aqil/Android/gradle-3.5
export PATH=$PATH:$GRADLE_HOME/bin
Final step, Tried building but encountered an error:
BUILD FAILED
Total time: 9 mins 33.837 secs Error: /home/aqil/App/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 ':_debugApk'. A problem occurred configuring project ':CordovaLib'. Could not resolve all dependencies for configuration ':CordovaLib:classpath'. Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3. Required by: project :CordovaLib Could not resolve com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3. Could not get resource 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.pom'. Could not GET 'https://jcenter.bintray.com/com/jfrog/bintray/gradle/gradle-bintray-plugin/1.7.3/gradle-bintray-plugin-1.7.3.pom'. Connect to jcenter.bintray.com:443 [jcenter.bintray.com/108.168.243.150] failed: Connection timed out (Connection timed out)
Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
this is network problem. Proxy helped me to bypass network filtering.

How to make Android Cordova project built with Gradle build offline?

I have a Ionic/Cordova project, builds for Android are done with Gradle.
I installed all necessary Android SDKs and the project was building fine for many months, but today it fails with the following error:
Running: d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\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:
BUILD FAILED
Total time: 26.792 secs
:android:unspecified
> Failed to list versions for com.android.tools.build:gradle.
> Unable to load Maven meta-data from https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml.
> Could not GET 'https://repo1.maven.org/maven2/com/android/tools/build/gradle/maven-metadata.xml'.
> Connection to https://repo1.maven.org refused
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
d:\git\myproject\platforms\android\cordova\node_modules\q\q.js:126
throw e;
^
Error code 1 for command: cmd with args: /s /c "d:\git\myproject\platforms\android\gradlew cdvBuildDebug -b d:\git\myproject\platforms\android\build.gradle -Dorg.gradle.daemon=true"
Error: cmd: Command failed with exit code 1
Cordova command failed with error code 1, aborting!
Clearly, since the project was building just fine for months, everything needed to have it build is already on disk, but the build is probably checking if there are updated version of artifacts in the Maven repo, and this is failing.
This is not a very desired behavior sometimes.
Is it possible to configure the build to always build offline?
So I grepped my repo for com.android.tools.build:gradle and I found it in a few files:
D:\git\myproject\platforms\android\build.gradle\build.gradle
D:\git\myproject\platforms\android\cordova\lib\plugin-build.gradle\plugin-build.gradle
D:\git\myproject\platforms\android\CordovaLib\build.gradle\build.gradle
I changed
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0+'
}
to
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
Hopefully this solves my issue, although the problem is gone now even with 1.0.0+, so I can't really verify that easily.
You can check which exact version of com.android.tools.build:gradle you have available locally in the following folder when on Windows:
$HOME\.gradle\caches\modules-2\files-2.1\com.android.tools.build\gradle

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