I'm learning react native navigation from https://reactnavigation.org/docs/hello-react-navigation
This is my package.json:
{
"name": "ReactNativeNavigation",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.10",
"#react-navigation/native": "^5.5.1",
"#react-navigation/stack": "^5.4.2",
"react": "16.11.0",
"react-native": "0.62.2",
"react-native-gesture-handler": "^1.6.1",
"react-native-reanimated": "^1.9.0",
"react-native-safe-area-context": "^3.0.2",
"react-native-screens": "^2.8.0"
},
"devDependencies": {
"#babel/core": "^7.10.2",
"#babel/runtime": "^7.10.2",
"#react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^26.0.1",
"eslint": "^7.2.0",
"jest": "^26.0.1",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
This is App.js:
Just copied the code
import * as React from 'react';
import { View, Text } from 'react-native';
import { NavigationContainer } from '#react-navigation/native';
import { createStackNavigator } from '#react-navigation/stack';
function HomeScreen() {
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>Home Screen</Text>
</View>
);
}
const Stack = createStackNavigator();
function App() {
return (
<NavigationContainer>
<Stack.Navigator>
<Stack.Screen name="Home" component={HomeScreen} />
</Stack.Navigator>
</NavigationContainer>
);
}
export default App;
When I run "react-native run-android",it doesn't work properly.
The screenshots is:
enter image description here
And error info in command prompt is:
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 ':react-native-screens'.
> Could not resolve all artifacts for configuration ':react-native-screens:classpath'.
> Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :react-native-screens
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'. Received status code 400 from server: Bad Request
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'. Received status code 400 from server: Bad Request
* 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 26s
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 ':react-native-screens'.
> Could not resolve all artifacts for configuration ':react-native-screens:classpath'.
> Could not resolve com.android.tools.build:gradle:3.3.1.
Required by:
project :react-native-screens
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'. Received status code 400 from server: Bad Request
> Could not resolve com.android.tools.build:gradle:3.3.1.
> Could not get resource 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'.
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/3.3.1/gradle-3.3.1.pom'. Received status code 400 from server: Bad Request
* 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 26s
at makeError (E:\learn\ReactNative\ReactNativeNavigation\node_modules\execa\index.js:174:9)
at E:\learn\ReactNative\ReactNativeNavigation\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (E:\learn\ReactNative\ReactNativeNavigation\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (E:\learn\ReactNative\ReactNativeNavigation\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
(I paste the code into "Code Snippet" in order to keep the code display normal,I used the stackovflow the first time)
What should I do to solve these problems?
In fact,the demo below is still not working:
import 'react-native-gesture-handler';
import * as React from 'react';
import { NavigationContainer } from '#react-navigation/native';
export default function App() {
return (
<NavigationContainer>{/* Rest of your app code */}</NavigationContainer>
);
}
When I comment out this line of code "import 'react-native-gesture-handler';"
It works!
I sincerely look forward to your help!
I run the project in android studio,but it display the error info
"Gradle project sync failed. Please fix your project and try again"
so I do the following:
1.click File->Invalidate Caches/Restart in android studio
2.edit C:\Users\your user name.gradle\gradle.properties
## For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
#
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx1024m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
#
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
#Mon Jun 08 10:57:14 GMT+08:00 2020
# systemProp.http.proxyHost=127.0.0.1
# systemProp.http.proxyPort=1080
# systemProp.https.proxyHost=127.0.0.1
# systemProp.https.proxyPort=1080
I Comment out the the last four lines codes;
3.wait the Gradle installed
4.close android studio
5.run:react-native run-andriod
the result is:
E:\learn\ReactNative\ReactNativeNavigation>react-native run-build
error Unrecognized command "run-build".
info Run "react-native --help" to see a list of all available commands.
E:\learn\ReactNative\ReactNativeNavigation>react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1103 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
> Task :app:processDebugResources 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
60 actionable tasks: 3 executed, 57 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Unable to delete directory 'E:\learn\ReactNative\ReactNativeNavigation\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx\appcompat' after 10 attempts
* 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 23s
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:
Execution failed for task ':app:processDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> Unable to delete directory 'E:\learn\ReactNative\ReactNativeNavigation\android\app\build\generated\not_namespaced_r_class_sources\debug\r\androidx\appcompat' after 10 attempts
* 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 23s
at makeError (E:\learn\ReactNative\ReactNativeNavigation\node_modules\execa\index.js:174:9)
at E:\learn\ReactNative\ReactNativeNavigation\node_modules\execa\index.js:278:16
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async runOnAllDevices (E:\learn\ReactNative\ReactNativeNavigation\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:5)
at async Command.handleAction (E:\learn\ReactNative\ReactNativeNavigation\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:186:9)
E:\learn\ReactNative\ReactNativeNavigation>
Finally,I open a command prompt and input:
react-native start
It works!
I encountered a lot of other mistakes in the process of solving the problem like
"Couldn't delete E:\learn\ReactNative\ReactNativeNavigation\android\app\build\outputs\apk\debug\output.json"
So I delete the file ,but I think this operation is useless.
another error is
"Android Studio AVD - Emulator: Process finished with exit code 1"
and so on.
At last, I want to know what it did when "react-native start" run.
When should I run react-native start?
I was still confused after reading it.
Thanks for Ravi reply.
I hope my answer helps.
Related
Hello everyone i'm not sure if this question is already answered, but i can't find a solution anywhere...
So I want to build my .apk from my bare react native project but when i do: .\gradlew assembleRelease i get the following error:
> Task :shopify_react-native-skia:buildCMakeRelWithDebInfo[arm64-v8a] FAILED
C/C++: ninja: Entering directory `C:\Users\jpizaf\Desktop\uoc\assignatures\semestre-actual\tfg\projecte-react-native\emage\node_modules\#shopify\react-native-skia\android\.cxx\RelWithDebInfo\2c3m102b\arm64-v8a'
C/C++: clang++: error: linker command failed with exit code 1 (use -v to see invocation)
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':shopify_react-native-skia:buildCMakeRelWithDebInfo[arm64-v8a]'.
> Build command failed.
Error while executing process C:\Users\jpizaf\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\jpizaf\Desktop\uoc\assignatures\semestre-actual\tfg\projecte-react-native\emage\node_modules\#shopify\react-native-skia\android\.cxx\RelWithDebInfo\2c3m102b\arm64-v8a reactskia}
ninja: Entering directory `C:\Users\jpizaf\Desktop\uoc\assignatures\semestre-actual\tfg\projecte-react-native\emage\node_modules\#shopify\react-native-skia\android\.cxx\RelWithDebInfo\2c3m102b\arm64-v8a'
[1/6] Building CXX object CMakeFiles/reactskia.dir/cpp/rnskia-android/SkiaOpenGLRenderer.cpp.o
[2/6] Building CXX object CMakeFiles/reactskia.dir/cpp/jni/JniPlatformContext.cpp.o
[3/6] Building CXX object CMakeFiles/reactskia.dir/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp.o
[4/6] Building CXX object CMakeFiles/reactskia.dir/cpp/jni/JniSkiaManager.cpp.o
[5/6] Building CXX object CMakeFiles/reactskia.dir/cpp/jni/JniLoad.cpp.o
[6/6] Linking CXX shared library ..\..\..\..\build\intermediates\cxx\RelWithDebInfo\2c3m102b\obj\arm64-v8a\libreactskia.so
FAILED: ../../../../build/intermediates/cxx/RelWithDebInfo/2c3m102b/obj/arm64-v8a/libreactskia.so
cmd.exe /C "cd . && C:\Users\jpizaf\AppData\Local\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android21 --gcc-toolchain=C:/Users/jpizaf/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=C:/Users/jpizaf/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/sysroot -fPIC -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -fexceptions -frtti -std=c++1y -DONANDROID -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID -O2 -g -DNDEBUG -Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a -Wl,--exclude-libs,libatomic.a -Wl,--build-id -Wl,--fatal-warnings -Wl,--no-undefined -Qunused-arguments -shared -Wl,-soname,libreactskia.so -o ..\..\..\..\build\intermediates\cxx\RelWithDebInfo\2c3m102b\obj\arm64-v8a\libreactskia.so CMakeFiles/reactskia.dir/cpp/jni/JniLoad.cpp.o CMakeFiles/reactskia.dir/cpp/jni/JniSkiaManager.cpp.o CMakeFiles/reactskia.dir/cpp/jni/JniPlatformContext.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia-android/SkiaOpenGLRenderer.cpp.o CMakeFiles/reactskia.dir/cpp/jsi/JsiHostObject.cpp.o CMakeFiles/reactskia.dir/cpp/jsi/JsiValue.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia/RNSkManager.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia/RNSkJsView.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia/RNSkDomView.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia/RNSkDispatchQueue.cpp.o CMakeFiles/reactskia.dir/cpp/rnskia/dom/base/DrawingContext.cpp.o CMakeFiles/reactskia.dir/cpp/api/third_party/CSSColorParser.cpp.o -LC:/Users/jpizaf/Desktop/uoc/assignatures/semestre-actual/tfg/projecte-react-native/emage/node_modules/#shopify/react-native-skia/android/../libs/android/arm64-v8a -LC:/Users/jpizaf/Desktop/uoc/assignatures/semestre-actual/tfg/projecte-react-native/emage/node_modules/#shopify/react-native-skia/android/build/fbjni-0.2.2.aar/jni/arm64-v8a -LC:/Users/jpizaf/Desktop/uoc/assignatures/semestre-actual/tfg/projecte-react-native/emage/node_modules/#shopify/react-native-skia/android/build/react-native-0.70.6-release.aar/jni/arm64-v8a -llog -lfbjni -lreact_nativemodule_core -ljsi -lturbomodulejsijni ../../../../../libs/android/arm64-v8a/libsvg.a ../../../../../libs/android/arm64-v8a/libskshaper.a ../../../../../libs/android/arm64-v8a/libskia.a -ljnigraphics -lGLESv2 -lEGL -landroid -latomic -lm && cd ."
C:/Users/jpizaf/AppData/Local/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/windows-x86_64/lib/gcc/aarch64-linux-android/4.9.x/../../../../aarch64-linux-android/bin\ld: cannot open output file ..\..\..\..\build\intermediates\cxx\RelWithDebInfo\2c3m102b\obj\arm64-v8a\libreactskia.so: No such file or directory
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
* 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.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
java.lang.StackOverflowError (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
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 11 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
BUILD FAILED in 25s
120 actionable tasks: 16 executed, 104 up-to-date
I'll show my package.json:
{
"name": "emage",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"#eva-design/eva": "^2.1.1",
"#klarna/react-native-vector-drawable": "^0.1.2",
"#miblanchard/react-native-slider": "^2.1.0",
"#react-native-async-storage/async-storage": "^1.17.11",
"#react-native-camera-roll/camera-roll": "^5.2.0",
"#react-navigation/native": "^6.1.0",
"#react-navigation/native-stack": "^6.9.5",
"#shopify/react-native-skia": "^0.1.167",
"#ui-kitten/components": "^5.1.2",
"#ui-kitten/eva-icons": "^5.1.2",
"clamp": "^1.0.1",
"react": "18.1.0",
"react-native": "0.70.6",
"react-native-fs": "^2.20.0",
"react-native-gesture-handler": "^2.8.0",
"react-native-image-picker": "^4.10.2",
"react-native-reanimated": "^2.13.0",
"react-native-safe-area-context": "^4.4.1",
"react-native-screens": "^3.18.2",
"react-native-svg": "^13.6.0",
"react-native-vector-image": "^0.3.3"
},
"devDependencies": {
"#babel/core": "^7.20.7",
"#babel/runtime": "^7.12.5",
"#react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0"
}
}
I've tryed creating a new project with just react native skia and it built the apk without a problem, but I have no idea what's wrong...
If anyone needs more info let me know.
Thanks ahead! <3
When I try to build my expo react native app using expo EAS services I get this error as follows,
Please consult deprecation warnings for more details.
426 actionable tasks: 426 executed
[stderr] FAILURE: Build failed with an exception.
[stderr] * What went wrong:
[stderr] Execution failed for task ':app:bundleReleaseJsAndAssets'.
[stderr] > Process 'command 'node'' finished with non-zero exit value 1
[stderr] * Try:
[stderr] > Run with --stacktrace option to get the stack trace.
[stderr] > Run with --info or --debug option to get more log output.
[stderr] > Run with --scan to get full insights.
[stderr] * Get more help at https://help.gradle.org
[stderr] BUILD FAILED in 3m 8s
Error: Gradle build failed with unknown error. See logs for the "Run gradlew" phase for more information.
my eas.json looks like this,
{
"cli": {
"version": ">= 2.4.1"
},
"build": {
"development": {
"developmentClient": true,
"distribution": "internal",
"android": {
"image": "ubuntu-18.04-jdk-11-ndk-r19c"
}
},
"preview": {
"distribution": "internal"
},
"production": {
"android": {
"buildType": "apk"
}
}
},
"submit": {
"production": {}
}
}
my app configuration is as follows,
minSdkVersion = '21'
buildToolsVersion = '31.0.0'
compileSdkVersion = '33'
targetSdkVersion = '33'
I'm trying to generate an apk here.
Can someone help, please
The real cause of the issue should be logged somewhere above
I initially tried using the react-native-elements for icons and other components. I followed the documentation to set things up but the icons were visible as a cross in a rectangle. During this I linked the vector icons by running "react-native link react-native-vector-icons" and also had added the following in setting.gradle in the android folder of the project:
rootProject.name = 'Vida'
apply from: '../node_modules/react-native-unimodules/gradle.groovy'
includeUnimodulesProjects()
apply from: file("../node_modules/#react-native-community/cli-platform-
android/native_modules.gradle");
applyNativeModulesSettingsGradle(settings)
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new
File(rootProject.projectDir,
'../node_modules/react-native-vector-icons/android')
Also the mainApplication.java file needed changes so I changed it to following:
#Override
protected List<ReactPackage> getPackages() {
List<ReactPackage> packages = new PackageList(this).getPackages();
packages.add(new ModuleRegistryAdapter(mModuleRegistryProvider));
package.add(new RNGestureHandlerPackage()); // THis is the change I made for handling gestures.
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage() // THis is the change for vector Icons
);
}
I also added the
implementation project(':react-native-vector-icons')
implementation project(':react-native-gesture-handler')
to build.gradle file.
After I restarted the app by first "react-native start" and "react-native run-android" and I came across "null is not an object ( evaluating 'RNGestureHandlerModule.default.Direction')" in my android emulator after which I tried searching online for solution and some saidn unistalling and reinstalling react-native-gesture-handlers will solve it so I tried uninstalling and reinstalling the gesture handler and tried restarting the meteor server and run "react-native run-android". But rather, I came across an error saying:
C:\Vida\VidaApp#20\VidaArchive\android\app\src\main\java\blah\com\MainActivity.java:8:
com.swmansion.gesturehandler.react does not exist
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;
^
C:\Vida\VidaApp#20\VidaArchive\android\app\src\main\java\blah\com\MainActivity.java:37:
find symbol
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errors
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 output. Run
with --scan to get full insights.
* Get more help at https://help.gradle.org
eact does not exist
import com.swmansion.gesturehandler.react.RNGestureHandlerEnabledRootView;;
^ ivity.java:37:
C:\Vida\VidaApp#20\VidaArchive\android\app\src\main\java\blah\com\MainActivity.java:37: error: cannot
find symbol his);
return new RNGestureHandlerEnabledRootView(MainActivity.this);
^
symbol: class RNGestureHandlerEnabledRootView
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
-debug option
* 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 38s
t-native-commu
at checkExecSyncError (child_process.js:635:11)
at execFileSync (child_process.js:653:15) tive-community
at runOnAllDevices (C:\Vida\VidaApp#20\VidaArchive\node_modules\#react-native-community\cli-platform-
android\build\commands\runAndroid\runOnAly\cli-platformlDevices.js:94:39)
at buildAndRun (C:\Vida\VidaApp#20\VidaArchive\node_modules\#react-native-community\cli-platform-
android\build\commands\runAndroid\index.js:17dules\react-na9:41)
at C:\Vida\VidaApp#20\VidaArchive\node_modules\#react-native-community\cli-platform-
android\build\commands\runAndroid\index.js:133:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Vida\VidaApp#20\VidaArchive\node_modules\react-
native\node_modules\#react-native-community\cli\build\index.js:182:9)
Also while I tried uninstalling gesture handler, visual studio crashed out and i had to open again and after I launched Vscode I reinstalled gesture-handlers, it showed the following error:
$ ...include ':react-native-gesture-handler'
bash: ...include: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: file-uri-to-path#1.0.0 (node_modules\file-uri-to-
path):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename
'C:\Vida\VidaApp#20\VidaArchive\node_modules\file-uri-to-path' ->
'C:\Vida\VidaApp#20\VidaArchive\node_modules\.file-uri-to-path.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: nan#2.14.2 (node_modules\nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename
'C:\Vida\VidaApp#20\VidaArchive\node_modules\nan'
-> 'C:\Vida\VidaApp#20\VidaArchive\node_modules\.nan.DELETE'
npm ERR! code ENOENT
npm ERR! syscall rename
npm ERR! path C:\Vida\VidaApp#20\VidaArchive\node_modules\#egjs\hammerjs
npm ERR! dest C:\Vida\VidaApp#20\VidaArchive\node_modules\#egjs\.hammerjs.DELETE
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, rename
'C:\Vida\VidaApp#20\VidaArchive\node_modules\#egjs\hammerjs' ->
'C:\Vida\VidaApp#20\VidaArchive\node_modules\#egjs\.hammerjs.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Shiri\AppData\Roaming\npm-cache\_logs\2020-10-31T07_52_44_306Z-debug.log
Currently my package.json file is as below:
{
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web"
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.10",
"#react-native-community/netinfo": "^5.8.1",
"#redux-offline/redux-offline": "^2.6.0-expo.0",
"bootstrap": "^4.5.2",
"expo": "~37.0.3",
"expo-linear-gradient": "~8.1.0",
"expo-screen-orientation": "^1.0.0",
"expo-splash-screen": "^0.2.3",
"expo-updates": "~0.2.0",
"pusher-js": "^7.0.0",
"react": "~16.9.0",
"react-bootstrap": "^1.3.0",
"react-dom": "~16.9.0",
"react-native": "~0.61.5",
"react-native-agora": "^2.9.1-alpha.7",
"react-native-banner-carousel": "^1.0.3",
"react-native-country-list": "^1.0.10",
"react-native-elements": "^3.0.0-alpha.1",
"react-native-gesture-handler": "~1.6.0",
"react-native-material-dropdown": "^0.11.1",
"react-native-material-textfield": "^0.16.1",
"react-native-reanimated": "~1.7.0",
"react-native-rename": "^2.4.1",
"react-native-safe-area-context": "^1.0.0",
"react-native-screens": "^2.7.0",
"react-native-snap-carousel": "^3.9.0",
"react-native-svg": "11.0.1",
"react-native-unimodules": "~0.9.0",
"react-native-vector-icons": "^7.0.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.3.9",
"react-navigation-stack": "^2.5.1",
"react-redux": "^7.2.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0",
"socket.io-client": "^2.3.0"
},
"devDependencies": {
"#babel/core": "^7.8.6",
"babel-jest": "~25.2.6",
"babel-preset-expo": "~8.1.0",
"jest": "~25.2.6",
"react-test-renderer": "~16.9.0"
},
"private": true,
"name": "VidaArchive",
"version": "1.0.0"
}
I need this issue to be fixed early because I need to show my work to my seniors. Also I am new to react-native environment, Hence, my concerns are:
How to set up and use react-native vector icons for android (alongwith third party libraries)?
What is this issue, RNGestureHandler?
It says Package react-native-gesture-handler has been ignored because it contains invalid
Reason: Cannot find module 'react-native-gesture-handler\package.json'. What is this and what is causing it so and how can I fix this?
So i have a bare react-native application wherein i am using expo modules.
I am using the expo location module and getting the following error.
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:361: error: cannot find symbol
new Permissions.PermissionsRequestListener() {
^
symbol: class PermissionsRequestListener
location: interface Permissions
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:502: error: cannot find symbol
mPermissions.getPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
^
symbol: method getPermission(String)
location: variable mPermissions of type Permissions
/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/LocationModule.java:503: error: cannot find symbol
&& mPermissions.getPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED
^
symbol: method getPermission(String)
location: variable mPermissions of type Permissions
Note: /home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/expo-location/android/src/main/java/expo/modules/location/taskConsumers/GeofencingTaskConsumer.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
3 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':expo-location: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 16s
at checkExecSyncError (child_process.js:607:13)
at execFileSync (child_process.js:627:13)
at runOnAllDevices (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/runOnAllDevices.js:94:39)
at buildAndRun (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:158:41)
at then.result (/home/amol/Desktop/AccountantComplete/CompleteCode/Accountant/node_modules/#react-native-community/cli-platform-android/build/commands/runAndroid/index.js:125:12)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:189:7);
So my best guess is there is an error while importing stuff from permission module.
So i have these lines in expo-permissions app level build.gradle file.
compileOnly('com.facebook.react:react-native:+') {
exclude group: 'com.android.support'
}
I am also using jettifier, i am guessing there is some issue with respect to transpiling code to android x.
I changed this
compileOnly('com.facebook.react:react-native:+') {
exclude group: 'com.android.support'
}
to
implementation 'com.facebook.react:react-native:+'
and everything works fine.
I would like to know exactly what is happening and if this deserves a pull request.
Any help on the same would be highly appreciated thanks.
ok, in my case I needed to raise the following versions from android/build.grade:
buildscript {
ext {
buildToolsVersion = "28.0.3" -> "29.0.2"
minSdkVersion = 21
compileSdkVersion = 28 -> 29
targetSdkVersion = 28 -> 29
}
I'm new to react-native and when I tried to integrate the react-native-maps with my react native app it's giving the following error.
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle'.
> startup failed:
settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle': 3: unexpected char: '\' # line 3, column 111.
node_modules\react-native-maps\lib\andro
^
1 error
This is my build.gradle dependencies array.
dependencies {
implementation project(':react-native-maps'){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
implementation 'com.google.android.gms:play-services-base:12.0.0'
implementation 'com.google.android.gms:play-services-maps:12.0.0'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.facebook.react:react-native:+" // From node_modules
}
And this is my settings.gradle file content.
rootProject.name = 'ReactNativeMaps'
include ':react-native-maps'
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '..\node_modules\react-native-maps\lib\android')
include ':app'
In case someone need to see the full error,
$ react-native run-android
Starting JS server...
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
FAILURE: Build failed with an exception.
* Where:
Settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle' line: 3
* What went wrong:
Could not compile settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle'.
> startup failed:
settings file 'D:\React-Projects\Native\ReactNativeMaps\android\settings.gradle': 3: unexpected char: '\' # line 3, column 111.
node_modules\react-native-maps\lib\andro
^
1 error
* 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
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.bat installDebug
Error: Command failed: gradlew.bat installDebug
at checkExecSyncError (child_process.js:616:11)
at Object.execFileSync (child_process.js:634:13)
at runOnAllDevices (D:\React-Projects\Native\ReactNativeMaps\node_modules\react-native\local-cli\runAndroid\runAndroid.js:299:19)
at buildAndRun (D:\React-Projects\Native\ReactNativeMaps\node_modules\react-native\local-cli\runAndroid\runAndroid.js:135:12)
at isPackagerRunning.then.result (D:\React-Projects\Native\ReactNativeMaps\node_modules\react-native\local-cli\runAndroid\runAndroid.js:65:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
I've installed the react-native-map also via following commands and link it also.
npm install --save react-native-maps
react-native link react-native-maps
And this is the package.json file.
{
"name": "ReactNativeMaps",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.6.3",
"react-native": "0.58.4",
"react-native-maps": "^0.23.0"
},
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
What went wrong? Did I miss something?
In your package.json change the react-native-maps as follows:
"react-native-maps": "https://github.com/react-community/react-native-maps.git"
In settings.gradle make sure your line 3 is:
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
Check if this works.
I found the problem. The reason that the build is the API_KEY. I replace the api-key with new api key and its working now. As well as change the line
project(':react-native-maps').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-maps/lib/android')
also