0

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.

Neha
  • 175
  • 1
  • 3
  • 18
  • Please visit the following link for the answer: [Link to the Answer](https://stackoverflow.com/a/53914373/10144583) – Ahmad Wahaj Jan 25 '19 at 07:52
  • When I go to build-> build Bundle(s)/APK(s) -> Build APK(s) then nothing happens. When I go to build -> build Bundle(s)/APK(s) -> Build Bundle(s) then it shows that Building Android App Bundles requires you to update to the latest version of the Android Gradle Plugin – Neha Jan 25 '19 at 08:03

2 Answers2

2

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

Hardik Virani
  • 1,687
  • 7
  • 23
  • 36
  • I am using this for android app. npm a --save react-native-gesture-handler . Should I write this ..? – Neha Jan 25 '19 at 05:21
  • you have to install above module paste above command in your terminal in app directory – Hardik Virani Jan 25 '19 at 05:22
  • @Neha Read the instructions here https://reactnavigation.org/docs/en/getting-started.html – JanithaR Jan 25 '19 at 05:24
  • Nothing is working @Hardik Virani. I used npm initially for my project. Then I upgraded gradle version using yarn. I uninstalled react-navigation and react-navigation-gesture-handler using npm and installed these again using yarn. Have I messed up things because of this. – Neha Jan 25 '19 at 07:06
  • ```watchman watch-del-all && rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules/ && npm cache clean --force && npm install && npm start -- --reset-cache``` try above command @Neha – Hardik Virani Jan 25 '19 at 07:08
  • I am using windows for development, so rm -rf does not work. what should I use instead I tried to search but nothing works and I keep getting some error. – Neha Jan 25 '19 at 07:38
1

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
Ritviz Sharma
  • 306
  • 1
  • 9