unable to make signed apk in react native - android

While trying to make signed apk of my react-native project using link
Generating Signed APK I am getting following error.
Unable to resolve module `./touchables` from `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\index.js`: The module `./touchables` could not be found from `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\index.js`. Indeed, none of these files exist: * `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\touchables(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\touchables\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
Error: Unable to resolve module `./touchables` from `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\index.js`: The module `./touchables` could not be found from `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\index.js`. Indeed, none of these files exist: * `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\touchables(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
* `C:\Users\pc\Desktop\GSTCalc\node_modules\react-native-gesture-handler\touchables\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)`
at ModuleResolver.resolveDependency (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:120:15)
at ResolutionRequest.resolveDependency (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:49:18)
at DependencyGraph.resolveDependency (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\node-haste\DependencyGraph.js:218:16)
at Object.resolve (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\lib\transformHelpers.js:141:30)
at dependencies.map.result (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\DeltaBundler\traverseDependencies.js:373:31)
at Array.map (<anonymous>)
at resolveDependencies (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\DeltaBundler\traverseDependencies.js:369:18)
at C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\DeltaBundler\traverseDependencies.js:188:33
at Generator.next (<anonymous>)
at step (C:\Users\pc\Desktop\GSTCalc\node_modules\metro\src\DeltaBundler\traverseDependencies.js:298:30)
What should I do? Thanks in advance.
Edit:
When I tried all the solution provided below I started getting a different
error.Which is as follows:
bundle: Writing bundle output to:
C:\Users\pc\Desktop\GSTAppDesign\GSTCalc\android\app\build\generated\assets\react\release\index.android.bundle
bundle: Done writing bundle output bundle: Copying 7 asset files
bundle: Done copying assets
C:\Users\pc.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\2e72d58316ce557e86b0d638298e5052\res\values-v28\values-v28.xml:9:5-12:13:
AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\pc\Desktop\GSTAppDesign\GSTCalc\android\app\build\intermediates\incremental\mergeReleaseResources\merged.dir\values-v28\values-v28.xml:11:
AAPT: error: resource android:attr/dialogCornerRadius not found.
C:\Users\pc.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\2e72d58316ce557e86b0d638298e5052\res\values\values.xml:1304:5-69:
AAPT: error: resource android:attr/fontVariationSettings not found.
C:\Users\pc.gradle\caches\transforms-1\files-1.1\appcompat-v7-28.0.0.aar\2e72d58316ce557e86b0d638298e5052\res\values\values.xml:1304:5-69:
AAPT: error: resource android:attr/ttcIndex not found.
error: failed linking references.

I think you are getting error because of you have installed react-navigation in you react native project fro this you have to also install below package.
try to install
npm i --save react-native-gesture-handler
react-native link react-native-gesture-handler
Try this one to clear and reset cache:
RN < 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
RN >= 0.50 - watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean && npm install && npm start -- --reset-cache
npm >= 5 - watchman watch-del-all && rm -rf $TMPDIR/react-* && rm -rf node_modules/ && npm cache verify && npm install && npm start -- --reset-cache
Windows - del %appdata%\Temp\react-native-* & cd android & gradlew clean & cd .. & del node_modules/ & npm cache clean --force & npm install & npm start -- --reset-cache
https://gist.github.com/jarretmoses/c2e4786fd342b3444f3bc6beff32098d
hope this will work for you, work for me

Before you build your signed APK first make sure you have your bundles in your assets in android folder.
Run this command to build the bundles
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Also, add this package for gesture handler
npm install -save react-native-gesture-handler

Related

How to resolve this error in react native? ERROR: http could not be found within the project or in these directories: node_modules

[enter image description here](https://i.stack.imgur.com/MY5Rn.png)
BUNDLE ./index.js
error: Error: Unable to resolve module http from /home/divum/Param/param-wallet-mobile/node_modules/https-browserify/index.js: http could not be found within the project or in these directories:
node_modules
../../node_modules
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
> 1 | var http = require('http')
| ^
2 | var url = require('url')
3 |
4 | var https = module.exports
at ModuleResolver.resolveDependency (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:129:15)
at DependencyGraph.resolveDependency (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/node-haste/DependencyGraph.js:288:43)
at Object.resolve (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/lib/transformHelpers.js:129:24)
at resolve (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:396:33)
at /home/divum/Param/param-wallet-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:411:33)
at processModule (/home/divum/Param/param-wallet-mobile/node_modules/metro/src/DeltaBundler/traverseDependencies.js:140:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:95:5)
I tried these steps :
Clear watchman watches: watchman watch-del-all
Delete node_modules and run yarn install
Reset Metro's cache: yarn start --reset-cache
Remove the cache: rm -rf /tmp/metro-*
I also tried cleaning my gradle ( ./gradlew clean) & cleared the cache and restarted again (npx react-native start --reset-cache , npx react-native run-android)
Please help me out , this error keeps on poping up to me. I can't even run my project because of this issue.

Implement ImagePicker into React-Native Android

I am trying to implement the image picker library into my react native project for android. However, I am getting a response error code of 500 which I cannot seem to understand even though I followed the video guide completely. The video guide which I followed is this https://www.youtube.com/watch?v=FXG3AJ6OJCk.
I also linked it by running the link after I have installed the library.
Any help would be greatly appreciates.
npm link react-native-image-picker
This is the function and when I call it, it returns the 500 error as shown below
import { ImagePicker } from 'react-native-image-picker';
takePic() {
ImagePicker.showImagePicker({}, (response)=> {
console.log(response);
})
}
Returned:
The development server returned response error code: 500
URL: http://192.168.1.105:19001/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&hot=false
Body:
{"originModulePath":"C:\\New_Mobile\\FYP\\src\\components\\Drawer\\Profile.js","targetModuleName":"react-native-image-picker","message":"Unable to resolve module `react-native-image-picker` from `C:\\New_Mobile\\FYP\\src\\components\\Drawer\\Profile.js`:
Module `react-native-image-picker` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n
1. Clear watchman watches: `watchman watch-del-all`.\n
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.","errors":[{"description":"Unable to resolve module `react-native-image-picker` from `C:\\New_Mobile\\FYP\\src\\components\\Drawer\\Profile.js`:
Module `react-native-image-picker` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n
1. Clear watchman watches: `watchman watch-del-all`.\n
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`."}],"name":"Error","stack":"Error: Unable to resolve module `react-native-image-picker` from `C:\\New_Mobile\\FYP\\src\\components\\Drawer\\Profile.js`:
Module `react-native-image-picker` does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n
1. Clear watchman watches: `watchman watch-del-all`.\n
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.\n
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`.\n
4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.\n at ModuleResolver.resolveDependency (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ModuleResolution.js:183:15)\n at ResolutionRequest.resolveDependency (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\node-haste\\DependencyGraph\\ResolutionRequest.js:52:18)\n at DependencyGraph.resolveDependency (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\node-haste\\DependencyGraph.js:283:16)\n at Object.resolve (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\lib\\transformHelpers.js:261:42)\n at dependencies.map.result (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:399:31)\n at Array.map (<anonymous>)\n at resolveDependencies (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:396:18)\n at C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:269:33\n at Generator.next (<anonymous>)\n at asyncGeneratorStep (C:\\New_Mobile\\FYP\\node_modules\\metro\\src\\DeltaBundler\\traverseDependencies.js:87:24)"}
processBundleResult
BundleDownloader.java:10
access$200
BundleDownloader.java:1
onChunkComplete
BundleDownloader.java:6
emitChunk
MultipartStreamReader.java:9
readAllParts
MultipartStreamReader.java:21
processMultipartResponse
BundleDownloader.java:4
access$100
BundleDownloader.java:1
onResponse
BundleDownloader.java:10
execute
RealCall.java:5
run
NamedRunnable.java:3
runWorker
ThreadPoolExecutor.java:1113
run
ThreadPoolExecutor.java:588
run
Thread.java:818
react-native-image-picker does not installed ,try execute this command
npm install --save react-native-image-picker & react-native link react-native-image-picker
you can read docs here

react-native run-androind giving error of 500 on first time

I just installed react native and created a fresh project, But when I'm running it by using react-native run-android command it is giving error. I didn't changed anything in any file the project is just created.
Here are the error and screenshot of it.
Error
The development server returned response error code: 500
URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
Body:
{"originModulePath":"C:\project\test\App.js","targetModuleName":"./../../react-transform-hmr/lib/index.js","message":"Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'","errors":[{"description":"Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'"}],"name":"Error","stack":"Error: Unable to resolve module './../../react-transform-hmr/lib/index.js' from 'C:\project\test\App.js': The module './../../react-transform-hmr/lib/index.js' could not be found from 'C:\project\test\App.js'. Indeed, none of these files exist:\n * 'C:\react-transform-hmr\lib\index.js(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n * 'C:\react-transform-hmr\lib\index.js\index(.native||.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)'\n at ModuleResolver.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:209:697)\n at ResolutionRequest.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph\ResolutionRequest.js:83:16)\n at DependencyGraph.resolveDependency (C:\project\test\node_modules\metro\src\node-haste\DependencyGraph.js:222:485)\n at Object.resolve (C:\project\test\node_modules\metro\src\lib\transformHelpers.js:149:25)\n at dependencies.map.result (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:316:29)\n at Array.map ()\n at resolveDependencies (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:312:16)\n at C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:169:33\n at Generator.next ()\n at step (C:\project\test\node_modules\metro\src\DeltaBundler\traverseDependencies.js:271:307)"}
processBundleResult
BundleDownloader.java:296
access$200
BundleDownloader.java:37
onResponse
BundleDownloader.java:174
execute
RealCall.java:153
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1113
run
ThreadPoolExecutor.java:588
run
Thread.java:818
Please help me get out of this...
Try these steps:
1- Clear the cache using:
rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*;
2 - If you are using the watchman, remove all watches and associated triggers with:
watchman watch-del-all
3 - Restart the Metro Bundler from the project folder
react-native start --reset-cache
4 - Run react-native run-android
I faced this problem before try this solutions,
1- Restart metro bundler with npm start
2- Restart project with different port react-native run-android --port=8088
Because sometimes default port 8081 may used by another app.

I'm Trying to run my reactNative app on emulator but I'm getting this error in android emulator

Error Image:
Following is the error message
The development server returned response error code: 500
URL: http://10.0.2.2:8081/index.delta?platform=android&dev=true&minify=false
Body:
{"originModulePath":"/home/junior/ReactNative/HelloWorld/index.js","targetModuleName":"#babel/runtime/helpers/interopRequireDefault","message":"Unable to resolve module #babel/runtime/helpers/interopRequireDefault from /home/junior/ReactNative/HelloWorld/index.js: Module #babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.\n 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.","errors":[{"description":"Unable to resolve module #babel/runtime/helpers/interopRequireDefault from /home/junior/ReactNative/HelloWorld/index.js: Module #babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.\n 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*."}],"name":"Error","stack":"Error: Unable to resolve module #babel/runtime/helpers/interopRequireDefault from /home/junior/ReactNative/HelloWorld/index.js: Module #babel/runtime/helpers/interopRequireDefault does not exist in the Haste module map\n\nThis might be related to https://github.com/facebook/react-native/issues/4968\nTo resolve try the following:\n 1. Clear watchman watches: watchman watch-del-all.\n 2. Delete the node_modules folder: rm -rf node_modules && npm install.\n 3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.\n 4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.\n at ModuleResolver.resolveDependency (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:209:1301)\n at ResolutionRequest.resolveDependency (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:83:16)\n at DependencyGraph.resolveDependency (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/node-haste/DependencyGraph.js:238:485)\n at Object.resolve (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/lib/transformHelpers.js:180:25)\n at dependencies.map.result (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:311:29)\n at Array.map ()\n at resolveDependencies (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:307:16)\n at /home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:164:33\n at Generator.next ()\n at step (/home/junior/ReactNative/HelloWorld/node_modules/metro/src/DeltaBundler/traverseDependencies.js:266:307)"}
processBundleResult
BundleDownloader.java:296
access$200
BundleDownloader.java:37
onResponse
BundleDownloader.java:174
execute
RealCall.java:153
run
NamedRunnable.java:32
runWorker
ThreadPoolExecutor.java:1167
run
ThreadPoolExecutor.java:641
run
Thread.java:764
Run these commands from the terminal ( in your project directory):
npm add #babel/runtime
npm install

React Native Command giving error

Hope everyone is doing great i have a issue in react native command i made the assets folder and after that running a command
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
but its giving me error again n again
Unable to resolve module `AccessibilityInfo` from `C:\AnkitaFolder\Vanilla1\node_modules\react-native\Libraries\react-native\react-native-implementation.js`: Module `AccessibilityInfo` does not exist in the Haste module map
This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:
1. Clear watchman watches: `watchman watch-del-all`.
2. Delete the `node_modules` folder: `rm -rf node_modules && npm install`.
3. Reset Metro Bundler cache: `rm -rf /tmp/metro-bundler-cache-*` or `npm start -- --reset-cache`. 4. Remove haste cache: `rm -rf /tmp/haste-map-react-native-packager-*`.
I tried everything possible but its still not working once it worked and again its giving the same error.Version i am using are mentioned below..
NPM-VER- 6.3.0
"react": "16.4.1",
"react-native": "0.56.0"
"devDependencies": {
"babel-jest": "23.4.2",
"babel-preset-react-native": "5",
"jest": "23.4.2",
"react-test-renderer": "16.4.1"
},
Try to clean npm and all caches. If its not helping maybe your bundle props is wrong or files corrupted
rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-*
cd android && ./gradlew clean
Delete all node_modules
npm cache clean or npm cache clean --force
Or
On windows React 0.56 not working forhttps://github.com/facebook/react-native/issues/19953alsohttps://github.com/facebook/react-native/issues/20353

Categories

Resources