React-native: Can't build the android app - javascript

I am a newbie, just started dipping my toe in react-native. The first hello world app did run okay, as I started the second one I am getting this error:
:app:transformClassesWithDexForDebug FAILED
FAILURE: Build failed with an exception.
*What went wrong:
Execution failed for task ':app:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException:java.lang.RuntimeException:com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: java.lang.UnsupportedOperationException
* 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: 14.034 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

It looks like your app is now multidex, you can learn mor about here
To solve this, just enable multidexing on build.gradle:
defaultConfig {
...
minSdkVersion 14
targetSdkVersion 21
...
// Enabling multidex support.
multiDexEnabled true
}

Related

i started work on my final year project on react native i face one error when i run this command "npm run android " then it show error

npm run andriod
Error
error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
What went wrong:
Could not open settings generic class cache for settings file 'C:\Users\Sharjil\AwesomeProject\android\settings.gradle' (C:\Users\Sharjil.gradle\caches\7.5.1\scripts\9hquuo8ig26y11gv08ef208wj).
BUG! exception in phase 'semantic analysis' in source unit 'BuildScript' Unsupported class file major version 63
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

Task :react-native-webview:compileDebugJavaWithJavac FAILED

I keep getting this error, when I try running my React Native application after installing the react-native.webview package. Please what could I be doing wrong.
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1135 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
Starting a Gradle Daemon, 1 busy Daemon could not be reused, use --status for details
> Task :react-native-webview:compileDebugJavaWithJavac
> Task :react-native-webview:compileDebugJavaWithJavac FAILED
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
79 actionable tasks: 14 executed, 65 up-to-date
C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewModule.java:276: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
^
symbol: variable Q
location: class VERSION_CODES
Note: C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-webview: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
BUILD FAILED in 1m 37s
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
C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewModule.java:276: error: cannot find symbol
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
^
symbol: variable Q
location: class VERSION_CODES
Note: C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Projects\React-Native\FUNAI\node_modules\react-native-webview\android\src\main\java\com\reactnativecommunity\webview\RNCWebViewManager.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
1 error
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-webview: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
BUILD FAILED in 1m 37s
at makeError (C:\Projects\React-Native\FUNAI\node_modules\execa\index.js:174:9)
at Promise.all.then.arr (C:\Projects\React-Native\FUNAI\node_modules\execa\index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)
I also have the same issue when I installed WebView.
To fix it, you need to update your compileSdkVersion to 29. While you are at it, you might as well update the buildToolsVersion. You can do that by changing these lines in your project's /android/build.gradle file.
buildscript {
ext {
…
buildToolsVersion = "29.0.3"
compileSdkVersion = 29
…
}
…
}

React-native Failed to process resources, see aapt output above for details

I need help with my first React-native app.
It generates
C:\Users\Bradburry\Downloads\Project Vlogee\Hasura>react-native run-android
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Configure project :app
WARNING: The option 'android.enableAapt2' is deprecated and should not be used anymore.
Use 'android.enableAapt2=true' to remove this warning.
It will be removed at the end of 2018..
C:\Users\Bradburry.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\eaf5e02e0fb5007b45b00a347d77a822\res\values-v24\values-v24.xml:3:5-157: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'.
C:\Users\Bradburry.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\eaf5e02e0fb5007b45b00a347d77a822\res\values-v24\values-v24.xml:4:5-135: AAPT: Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
C:\Users\Bradburry.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.1.1.aar\eaf5e02e0fb5007b45b00a347d77a822\res\values-v26\values-v26.xml:13:5-16:13: AAPT: No resource found that matches the given name: attr 'android:keyboardNavigationCluster'.
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
Failed to process resources, see aapt output above 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
BUILD FAILED in 32s
13 actionable tasks: 3 executed, 10 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

Ionic run app on device exit code 1

I've spent all day trying to fix this error, i have no idea why this happens. i can build both iOS and android, but when i try to run on device, both iOS and android Exit code 1, here the log
BUILD SUCCESSFUL
Total time: 21.515 secs
Built the following apk(s):
/Users/Jose/Desktop/smarket/platforms/android/build/outputs/apk/android-debug.apk
ANDROID_HOME=/Users/Jose/Library/Android/sdk
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_131.jdk/Contents/Home
Skipping build...
Built the following apk(s):
/Users/Jose/Desktop/smarket/platforms/android/build/outputs/apk/android-debug.apk
Using apk: /Users/Jose/Desktop/smarket/platforms/android/build/outputs/apk/android-debug.apk
Package name: io.ionic.starter
Error: Failed to install apk to device: [ 0%] /data/local/tmp/android-debug.apk
[ 2%] /data/local/tmp/android-debug.apk
...
[ 99%] /data/local/tmp/android-debug.apk
[100%] /data/local/tmp/android-debug.apk
/Users/Jose/Desktop/smarket/platforms/android/build/outputs/apk/android-deb
[ERROR] Cordova encountered an error.
You may get more insight by running the Cordova command above directly.
[ERROR] An error occurred while running cordova run android --device (exit code 1).

FAILURE: Build failed with an exception. - React Native

I'm Testing My React Native Installation
First
react-native start
After That
react-native run-android
I Connected my Device to pc, But I have This Error:
Scanning 557 folders for symlinks in D:\Projects 2016\Web\Android\FirstApp\AwesomeProject\node_modules (15ms)
JS server already running.
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Build file 'D:\Projects 2016\Web\Android\FirstApp\AwesomeProject\android\app\build.gradle' line: 1
* What went wrong:
A problem occurred evaluating project ':app'.
> java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.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: 2.533 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
It seems to the issue related with this question.
And the react-native docs indicates that it requires latest version of JDK.
Update your JDK version to latest one.

Categories

Resources