I would like to create a splash screen in my React Native app (not Expo) using Android Studio's emulator.
I was trying to add a splash_screen.xml file into android/app/src/main/res/drawable folder. When I put a new .xml file into the android folder the React compiler shows the following error message:
iMac:newtest Dora$ react-native run-android
JS server already running.
Building and installing the app on the device (cd android && ./gradlew installDebug)...
Configure project :app
WARNING: The specified Android SDK Build Tools version (28.0.2) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.2.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '28.0.2'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
com.android.build.gradle.tasks.ResourceException (no error message)
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
9 actionable tasks: 1 executed, 8 up-to-date
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
Command failed: ./gradlew installDebug
Error: Command failed: ./gradlew installDebug
at checkExecSyncError (child_process.js:637:11)
at Object.execFileSync (child_process.js:655:13)
at runOnAllDevices (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:299:19)
at buildAndRun (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:135:12)
at isPackagerRunning.then.result (/Users/Dora/Documents/code/react native/newtest/node_modules/react-native/local-cli/runAndroid/runAndroid.js:65:12)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Thank you for taking your time to help me to solve this issue!
Cheers,
Alex
Well, finally I have managed to solve this issue. It is for those who will encounter this problem during Android development.
So, what i did exactly:
1. cd into android folder and run this: ./gradlew installDebug
After this command finished without any errors
go back to the root directory and start the app using: react-native run-android
Conclusion, if you add or change any xml files in android folder, you have to do the above procedure.
That's all!
Alex
Related
I'm building my first cordova app and I'm trying to install it on my Android phone to check if everything is working.
But I keep getting the same error message over and over again:
C:\LesCordova\project_cordova>cordova build android
Checking Java JDK and Android SDK versions
ANDROID_SDK_ROOT=C:\Android-SDK (recommended setting)
ANDROID_HOME=undefined (DEPRECATED)
Using Android SDK: C:\Android-SDK
Subproject Path: CordovaLib
Subproject Path: app
Task :app:mergeDebugResources FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:mergeDebugResources'.
This project uses AndroidX dependencies, but the 'android.useAndroidX' property is not enabled. Set this property to true in the gradle.properties file and retry.
The following AndroidX dependencies are detected: androidx.versionedparcelable:versionedparcelable:1.0.0, androidx.fragment:fragment:1.0.0, androidx.slidingpanelayout:slidingpanelayout:1.0.0, androidx.core
:core:1.0.0, androidx.customview:customview:1.0.0, androidx.swiperefreshlayout:swiperefreshlayout:1.0.0, androidx.interpolator:interpolator:1.0.0, androidx.loader:loader:1.0.0, androidx.drawerlayout:drawerla
yout:1.0.0, androidx.viewpager:viewpager:1.0.0, androidx.collection:collection:1.0.0, androidx.localbroadcastmanager:localbroadcastmanager:1.0.0, androidx.lifecycle:lifecycle-common:2.0.0, androidx.arch.core
:core-common:2.0.0, androidx.annotation:annotation:1.1.0, androidx.legacy:legacy-support-core-ui:1.0.0, androidx.lifecycle:lifecycle-livedata:2.0.0, androidx.lifecycle:lifecycle-viewmodel:2.0.0, androidx.lif
ecycle:lifecycle-livedata-core:2.0.0, androidx.arch.core:core-runtime:2.0.0, androidx.legacy:legacy-support-core-utils:1.0.0, androidx.documentfile:documentfile:1.0.0, androidx.cursoradapter:cursoradapter:1.
0.0, androidx.lifecycle:lifecycle-runtime:2.0.0, androidx.coordinatorlayout:coordinatorlayout:1.0.0, androidx.asynclayoutinflater:asynclayoutinflater:1.0.0, androidx.print:print:1.0.0
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 1s
7 actionable tasks: 1 executed, 6 up-to-date
Command failed with exit code 1: C:\LesCordova\project_cordova\platforms\android\gradlew cdvBuildDebug -b C:\LesCordova\project_cordova\platforms\android\build.gradle
I already tried to change the android.useAndroidX property to true, but it changes back to false.
I already deleted the platform/android directory.
I realy hope someone knows what I'm doing wrong, because I'm running out of time...
Thank you!
Greetings Joyce
I'm using VS code without Android studio in Ubuntu 20.04. While running the first app in flutter in debugging mode in an real device produced this error given below. I also tried to change my JDK version but it didn't worked.
Launching lib/main.dart on Nokia 6 1 Plus in debug mode...
FAILURE: Build failed with an exception.
* What went wrong:
Could not initialize class org.codehaus.groovy.runtime.InvokerHelper
* 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 12s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 18.3s
Exception: Gradle task assembleDebug failed with exit code 1
Please suggest a solution!
Your gradle sync has failed for some reason.
Do this
File > Open
Navigate to your project
You will see an android folder there open that as project in a new window
Check the gradle sync issues and resolve those
Whenever I try to run 'react-native run-android'
I got failure:
Execution failed for task ':app:packageDebug'
I tried checkout to previus commits.
I tried removing android/app/build and re-build
I tried removing debug.keystore and initiated it again.
none of them solved the problem.
I successfully run my app before in android virtual device, and I've already uploaded my app to google play store, and it works.
I haven't seen this error before. My code worked totally fine before:
I removed some font files in android/src/main/assets/fonts. This maybe the reason.
I ran "react-native run-ios". This may be the reason.
Task :app:packageDebug FAILED
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
117 actionable tasks: 5 executed, 112 up-to-date
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:packageDebug'.
4 exceptions were raised by workers:
java.io.UncheckedIOException: java.io.IOException: Execution of compression failed.
java.io.UncheckedIOException: java.io.IOException: Execution of compression failed.
java.io.UncheckedIOException: java.io.IOException: Execution of compression failed.
java.io.UncheckedIOException: java.io.IOException: Execution of compression failed.
BUILD FAILED in 22s
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:74:39)
at buildAndRun (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/Users/leonkong/Desktop/dev/CoddingHippo/Native_Makkcha/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
Build Success message. And running app on virtual device by android studio 2
Clean Gradle
cd android
./gradlew clean
I just restarted my computer and ran ./gradlew assembleRelease again in the project's android folder and it worked.
I also face issue.
I just open Android Studio - Clear Build - Run app.
Works for me
I followed these steps
Uninstall app from emulator
Remove build from android
Run ./gradlew clean in android
Run react-native start --reset-cache
Run react-native run-android
It worked for me
I am using android studio idea for my libgdx project. I configured custom desktop configuration setting
Tasks: desktop:run
Gradle Project: mygame
Running android works fine but running this configuration brings the following error
9:08:42 PM: Executing task 'desktop:run'...
Executing tasks: [desktop:run]
Configuration on demand is an incubating feature. WARNING:
Configuration 'compile' is obsolete and has been replaced with
'implementation'. It will be removed at the end of 2018 Gradle now
uses separate output directories for each JVM language, but this build
assumes a single directory for all classes from a source set. This
behaviour has been deprecated and is scheduled to be removed in Gradle
5.0 at build_4irp102idy0ifcnkhwn53osnp$_run_closure3.doCall(D:\LibgdxProjects\Tembo\desktop\build.gradle:22)
(Run with --stacktrace to get the full stack trace of this
deprecation warning.)
FAILURE: Build failed with an exception.
What went wrong: java.lang.NullPointerException (no error message)
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 9:08:45 PM: Task execution finished 'desktop:run'.
Important details
Gradle version: 4.4
How can i fix this. I tried downgrading my gradle version but the minimim supported is 4.4
NOTE: running gradlew desktop:run on project root works.
currently this version of gradle is not supported you can use version 2.3.3
There is an activity to upgrade to Gradle 4.6 which you can follow up here
https://github.com/libgdx/libgdx/issues/5177
When i want run react-native run-android command i see
FAILURE: Build failed with an exception.
What went wrong: A problem occurred configuring root project 'reactNativeCliTest'.
Could not resolve all dependencies for configuration ':classpath'.
Could not download gradle-core.jar (com.android.tools.build:gradle-core:2.2.3)
Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.3/gradle-core-2.2.3.jar'.
Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle-core/2.2.3/gradle-core-2.2.3.jar'.
Connect to jcenter.bintray.com:443 [jcenter.bintray.com/75.126.118.188] failed: Connection timed out:
connect
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: 26.854 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 use genymotion .
thank you ...
RN is trying to download a new version of gradle and get error code 443. This error is related to misconfigured system files in your windows operating system. It's not related to react native and you can search about fix this error in your system.
as an experience, you have to use hotspot shield or strong vpn to download from jcenter in iran!
this link may help you: http://www.wiki-errors.com/err.php?wiki=443