无法在本机反应中使签名的apk

时间:2019-01-25 05:08:07

标签: android react-native signed-apk

尝试使用链接使我的本机项目的签名apk  Generating Signed APK我遇到以下错误。

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)

我该怎么办?预先感谢。

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   捆绑软件:完成捆绑软件的输出捆绑软件:复制7个资产文件   捆绑:完成复制资产

     

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:错误:未找到资源android:attr / dialogCornerRadius。

     

C:\ Users \ pc \ Desktop \ GSTAppDesign \ GSTCalc \ android \ app \ build \ intermediates \ incremental \ mergeReleaseResources \ merged.dir \ values-v28 \ values-v28.xml:11:   AAPT:错误:未找到资源android:attr / dialogCornerRadius。

     

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:错误:找不到资源android:attr / fontVariationSettings。

     

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:错误:找不到资源android:attr / ttcIndex。

     

错误:链接引用失败。

2 个答案:

答案 0 :(得分:2)

我认为由于在自己的本机项目中安装了react-navigation导致错误,因此还必须安装以下软件包。

尝试安装

npm i --save react-native-gesture-handler

react-native link react-native-gesture-handler
  

尝试以下操作清除并重置缓存:

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

希望这对您有用,对我有用

答案 1 :(得分:1)

在首先构建签名的APK之前,请确保将捆绑包放在android文件夹中的资产中。

运行此命令以构建捆绑包

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

此外,将此包添加为手势处理程序

npm install -save react-native-gesture-handler