I'm trying to run a release APK.
I download the bundle just fine, I create the signed APK via Android Studio, and I install it via adb install.
When I run the app, in log cat I see:
Got JS Exception: SyntaxError: Unexpected keyword 'const' Const declarations are not supported in strict mode
and
Got JS Exception: ReferenceError: Can't find variable: require.
I thought RN was transpiled via babel. What gives?
I had a similar problem.
Solved it by upgrading node to 4.2
I just tried this now.
In 'use strict' mode you can specify const properties. There is no impact in the release APK build.
Related
I have followed the installation steps, but when I start the application on android I get an error saying: "Cannot read property 'getSupportedBiometryType' of null, please check the last image.
Run yarn add react-native-keychain - Only for React Native <= 0.59: $ react-native link react-native-keychain and check MainApplication.java to verify the package was added. See manual installation below if you have issues with the react-native link.
Run pod install in iOS/directory to install iOS dependencies.
If you want to support FaceID, add an NSFaceIDUsageDescription entry in your Info.plist.
Re-build your Android and iOS projects.`
On iOS Everything works fine and the getSupportedBiometryType returns a string or null depending if the biometrics authentication is enabled.
On android on another hand, I get a Render Error: Cannot Read property 'getSupportedBiometryType' of null.
I also did the react-native link react-native-keychain command to try to fix the issue, but I had no luck.
Note: I also did the Manual Android install as described in the library installation guide.
Note: Everything works fine on iOS.
Packages:
"react-native": "0.64.2"
"react-native-keychain": "^8.1.0"
Keychain library import
.getSupportedBiometryType() function call
Error Message on Android Device
I'm getting the below error when connecting to the packager from the expo app:
bundling failed: node_modules/expo/AppEntry.js: /Volumes/Tub/Work/TOYL/REACT_NATIVE/rn-complete-guide/babel.config.js: Error while loading config - You appear to be using a native ECMAScript module configuration file, which is only supported when running Babel asynchronously.
I'm new to react development, and want to use VSCode directly for debugging, not Chrome.
I wrote a React app which used a 3rd party library and had no issues. I am now trying to write the equivalent app in React-Native (as a learning exercise) and I am running into an error as soon as I try and call an API in the 3rd party library.
I am on a windows machine and have react versions
"react": "16.9.0",
"react-native": "0.61.5",
Error
The error I am seeing in the window showing the metro builder has
error: bundling failed: src\scripts\my3rdPartyLib.js: src\scripts\my3rdPartyLib.js:Invalid call at line 121:
require([something], function (....
In my Android emulator I am seeing
The development server returned response error code : 500
Note: It also fails if i have the library coming from node-modules as apposed to copying it into my "scripts" folder.
What I have tried
As per a thread on SO i uninstalled babel-preset-react-native and then installed it.
npm un -D babel-preset-react-native
npm i -D babel-preset-react-native#2.1.0
Afterwards I realised as I am on version 61 it uses "metro-react-native-babel-preset", my babel.config.js contains the following
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
};
Does anyone have an idea how I can get the use of the 3rd party library working in my react-native app?
After Googling, it is my understanding that React Native uses the metro bundler which doesn't seem to support dynamic require().
https://github.com/facebook/metro/issues/52
React Native: require() with Dynamic String?
Further investigation into the library that i am trying to use, i see that it is expecting to either be run in the browser or a Node environment. For ReactNative this is not the case, therefore I believe I can not use this library in my application.
The exact error I get when I start the app is bundling failed:
Error: Unable to resolve module react-is from
/Users/someguy/projects/third/some-app/node_modules/react-navigation/node_modules/react-native-tab-view/node_modules/prop-types/index.js:
Module does not exist in the module map
The strange this about this error is that it only occurs when if I add
android:usesCleartextTraffic="true"
inside the AndroidManifest.xml file. This is needed due to the upgrade to SDK28. If I build the app without
android:usesCleartextTraffic="true"
I am able to start and run the app normally, but the metro bundler does NOT run and I can't access the debugger.
Should I add react-is to my package.json or do I just use npm and install it locally?
Turns out that by installing react-is. Fixes the problem.
We have an app previously built on phonegap and now migrated to React Native/Expo. We are trying to build the android .apk using the keystore we had before and we get the following error:
I know that the problem is not with my .keystore, since through expo fetch:android:keystore I’ve got the keystore generated by EXPO and it gives me the same error!
Using expo build:android works fine, but I can’t deploy since the fingerprints doesn’t match with the app I have already published.
Any ideas?
Thanks!
There was an issue with expo-cli 2.7.1 and it's fixed on 2.7.2. So just needed to update my cli version!