Can't integrate react-native-maps for react-native app - react-native

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

Related

I follow react-navigation docs, but it doesn't work, Mainly "react-native-screens"

this is my package.json:
{
"name": "awesomeproject1",
"version": "0.0.1",
"private": true,
"scripts": {
"a": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.11",
"#react-navigation/native": "^5.9.8",
"#react-navigation/native-stack": "^6.2.5",
"react": "16.8.1",
"react-native": "0.61.3",
"react-native-gesture-handler": "^1.10.3",
"react-native-safe-area-context": "^3.3.2",
"react-native-screens": "^3.9.0",
"react-native-tab-navigator": "^0.3.4"
},
"devDependencies": {
"#babel/core": "^7.5.0",
"#babel/runtime": "^7.5.0",
"#react-native-community/eslint-config": "^0.0.3",
"babel-jest": "^24.1.0",
"jest": "^24.1.0",
"metro-react-native-babel-preset": "^0.51.1",
"react-test-renderer": "16.8.1"
},
"jest": {
"preset": "react-native"
}
}
when npm run a,
PS I:\loan> npm run a
> awesomeproject1#0.0.1 a I:\loan
> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 971 file(s) to forward-jetify. Using 12 workers...
info Starting JS server...
info Installing the app...
> Task :react-native-screens:compileDebugKotlin 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.5/userguide/command_line_interface.html#sec:command_line_warnings
62 actionable tasks: 18 executed, 44 up-to-date
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (20, 38): Unresolved reference: ReactTypefaceUtils
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (206, 37): Unresolved reference: ReactTypefaceUtils
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (325, 28): Unresolved reference: ReactTypefaceUtils
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> Compilation error. See log for more 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 41s
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
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (20, 38): Unresolved reference: ReactTypefaceUtils
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (206, 37): Unresolved reference: ReactTypefaceUtils
e: I:\loan\node_modules\react-native-screens\android\src\main\java\com\swmansion\rnscreens\ScreenStackHeaderConfig.kt: (325, 28): Unresolved reference: ReactTypefaceUtils
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':react-native-screens:compileDebugKotlin'.
> Compilation error. See log for more 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 41s
at checkExecSyncError (child_process.js:790:11)
at execFileSync (child_process.js:827:15)
at runOnAllDevices (I:\loan\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at buildAndRun (I:\loan\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:179:41)
at I:\loan\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:133:12
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at async Command.handleAction (I:\loan\node_modules\react-native\node_modules\#react-native-community\cli\build\index.js:182:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! awesomeproject1#0.0.1 a: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the awesomeproject1#0.0.1 a script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Yiming\AppData\Roaming\npm-cache\_logs\2021-11-23T09_11_23_054Z-debug.log
Please!!!How to solve it...
this is build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
this is right version,
{
"name": "awesomeproject1",
"version": "0.0.1",
"private": true,
"scripts": {
"a": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"#react-native-community/masked-view": "^0.1.6",
"#react-navigation/bottom-tabs": "^5.11.15",
"#react-navigation/native": "^5.0.2",
"#react-navigation/stack": "5.x",
"i": "^0.3.7",
"npm": "^8.1.4",
"prop-types": "^15.7.2",
"react": "16.8.1",
"react-native": "0.61.3",
"react-native-gesture-handler": "^1.10.3",
"react-native-reanimated": "^1.7.0",
"react-native-safe-area-context": "^3.1.0-beta.1",
"react-native-screens": "^2.0.0-beta.2",
"react-native-vector-icons": "^9.0.0"
},
"devDependencies": {
"#babel/core": "^7.5.0",
"#babel/runtime": "^7.5.0",
"#react-native-community/eslint-config": "^0.0.3",
"babel-jest": "^24.1.0",
"jest": "^24.1.0",
"metro-react-native-babel-preset": "^0.51.1",
"react-test-renderer": "16.8.1"
},
"jest": {
"preset": "react-native"
}
}

react-native-gesture-handler can not be installed and shows compilation error

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?

how to use createStackNavigator correctly in react native

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.

react-native init AwesomeProject - fails to build

I cannot get a vanilla react-native project to build immediately after running react-native init. I have not made any changes to the project, nor run other commands.
Commands/output:
> react-native init AwesomeProject
> cd AwesomeProject
> react-native run-ios
....
** BUILD FAILED **
The following commands produced analyzer issues:
Analyze Base/RCTModuleMethod.mm normal x86_64
Analyze RCTVibration.m normal x86_64
(2 commands with analyzer issues)
The following build commands failed:
CompileC build/RCTVibration.build/Debug-iphonesimulator/RCTVibration.build/Objects-normal/x86_64/RCTVibration.o RCTVibration.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Installing build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app
An error was encountered processing the command (domain=com.apple.CoreSimulator.SimError, code=164):
Unable to lookup in current state: Shutdown
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/AwesomeProject57.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
at checkExecSyncError (child_process.js:601:13)
at Object.execFileSync (child_process.js:621:13)
at Promise.then (/Users/local/common/native-attempt/AwesomeProject57/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
at <anonymous>
Mac OS X: 10.3.4
XCode: 9.4.1
react-native: 0.57
react: 16.5.0
package.json:
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.5.0",
"react-native": "0.57.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.45.2",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
}
}
After looking around StackOverflow, I tried:
rm -rf node_modules
rm -fr $TMPDIR/react-*
watchman watch-del-all
Using react-native run-ios still failed. FWIW, I did open the project in XCode and tried to build it there. I received a build error "/Users/local/common/native-attempt/AwesomeProject/node_modules/react-native/Libraries/Text/RawText/RCTRawTextViewManager.h:8:9: 'React/RCTViewManager.h' file not found". Different error, but I assume it is related.
Really pulling my hair out... any help appreciated.

bundling error on react native app (ambigous resolution)

Bundling `index.js` [development, non-minified] 0.0% (0/1), failed.
error: bundling failed: ambiguous resolution: module `C:\Users\mtlok\Desktop\RN2\pep_beta\index.js` tries to require `react-native`, but there are several files providing this module. You can delete or fix them:
* `C:\Users\mtlok\Desktop\RN2\pep_beta\node_modules\react-native-responsive-dimensions\node_modules\react-native\package.json`
* `C:\Users\mtlok\Desktop\RN2\pep_beta\node_modules\react-native\package.json`
Im getting this error when bundling react-native app.
This issue may be caused by the react-native-responsive-dimensions package
Here is the package.json file:
{
"name": "react-native-responsive-dimensions",
"version": "1.0.1",
"description": "Resposive fontSize, height and width for your react-native components.",
"main": "src/index.js",
"scripts": {
"start": "node src/index.js",
"test": "exit 0"
},
"keywords": [
"react-native",
"responsive",
"responsive-height",
"responsive-width",
"responsive-font-size",
"fontSize",
"responsive-dimensions"
],
"author": "DaniAkash <s.daniakash#gmail.com> (https://github.com/DaniAkash)",
"repository": "DaniAkash/react-native-responsive-dimensions",
"license": "MIT",
"dependencies": {
"react-native": "x"
}
}
Also, there is a node_modules folder located inside node_modules/react-native-responsive-dimensions.
Is there a quick fix?
Try this command. maybe it's because of cache.
yarn start -- --reset-cache
or
npm start -- --reset-cache
if it doesn't work you can try react-native-git-upgrade or you can just delete node_modules folder then run npm install,react-native upgrade ande react-native-link
You can uninstall react-native-responsive-dimensions package first.
npm uninstall react-native-responsive-dimensions --save
And then
yarn start -- --reset-cache or npm start -- --reset-cache
react-native run-android or react-native run-ios