当前位置: 首页 > 知识库问答 >
问题:

使用React Native创建apk时遇到麻烦

南门嘉
2023-03-14

我是新来的React Native,刚刚用React Native init rnapp命令创建了一个应用程序,它发出了许多警告:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})
npm WARN react-native@0.61.5 requires a peer of react@16.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules\fsevents\node_modules\abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\abbrev' -> 'D:\rn
app\node_modules\fsevents\node_modules\.abbrev.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules\fsevents\node_modules\ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ansi-regex' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules\fsevents\node_modules\aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\aproba' -> 'D:\rn
app\node_modules\fsevents\node_modules\.aproba.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules\fsevents\node_modules\balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\balanced-match' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.3 (node_modules\fsevents\node_modules\chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\chownr' -> 'D:\rn
app\node_modules\fsevents\node_modules\.chownr.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules\fsevents\node_modules\code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\code-point-at' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.code-point-at.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules\fsevents\node_modules\concat-map):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\concat-map' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.concat-map.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules\fsevents\node_modules\console-control-strings):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\console-control-s
trings' -> 'D:\rnapp\node_modules\fsevents\node_modules\.console-control-strings.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules\fsevents\node_modules\core-util-is):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\core-util-is' ->
'D:\rnapp\node_modules\fsevents\node_modules\.core-util-is.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules\fsevents\node_modules\deep-extend):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\deep-extend' -> '
D:\rnapp\node_modules\fsevents\node_modules\.deep-extend.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules\fsevents\node_modules\delegates):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\delegates' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.delegates.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules\fsevents\node_modules\detect-libc):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\detect-libc' -> '
D:\rnapp\node_modules\fsevents\node_modules\.detect-libc.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules\fsevents\node_modules\fs.realpath):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\fs.realpath' -> '
D:\rnapp\node_modules\fsevents\node_modules\.fs.realpath.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules\fsevents\node_modules\has-unicode):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\has-unicode' -> '
D:\rnapp\node_modules\fsevents\node_modules\.has-unicode.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules\fsevents\node_modules\inherits):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\inherits' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.inherits.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules\fsevents\node_modules\ini):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ini' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.ini.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules\fsevents\node_modules\isarray):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\isarray' -> 'D:\r
napp\node_modules\fsevents\node_modules\.isarray.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@0.0.8 (node_modules\fsevents\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\minimist' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules\fsevents\node_modules\ms):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ms' -> 'D:\rnapp\
node_modules\fsevents\node_modules\.ms.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules\fsevents\node_modules\npm-normalize-package-bin):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\npm-normalize-pac
kage-bin' -> 'D:\rnapp\node_modules\fsevents\node_modules\.npm-normalize-package-bin.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules\fsevents\node_modules\number-is-nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\number-is-nan' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.number-is-nan.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules\fsevents\node_modules\object-assign):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\object-assign' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.object-assign.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules\fsevents\node_modules\os-homedir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-homedir' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.os-homedir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules\fsevents\node_modules\os-tmpdir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-tmpdir' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.os-tmpdir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules\fsevents\node_modules\path-is-absolute):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\path-is-absolute'
 -> 'D:\rnapp\node_modules\fsevents\node_modules\.path-is-absolute.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules\fsevents\node_modules\process-nextick-args):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\process-nextick-a
rgs' -> 'D:\rnapp\node_modules\fsevents\node_modules\.process-nextick-args.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.0 (node_modules\fsevents\node_modules\rc\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\m
inimist' -> 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules\fsevents\node_modules\safe-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safe-buffer' -> '
D:\rnapp\node_modules\fsevents\node_modules\.safe-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules\fsevents\node_modules\safer-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safer-buffer' ->
'D:\rnapp\node_modules\fsevents\node_modules\.safer-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules\fsevents\node_modules\sax):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\sax' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.sax.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules\fsevents\node_modules\semver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\semver' -> 'D:\rn
app\node_modules\fsevents\node_modules\.semver.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules\fsevents\node_modules\set-blocking):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\set-blocking' ->
'D:\rnapp\node_modules\fsevents\node_modules\.set-blocking.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules\fsevents\node_modules\signal-exit):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\signal-exit' -> '
D:\rnapp\node_modules\fsevents\node_modules\.signal-exit.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules\fsevents\node_modules\strip-json-comments):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\strip-json-commen
ts' -> 'D:\rnapp\node_modules\fsevents\node_modules\.strip-json-comments.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules\fsevents\node_modules\util-deprecate):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\util-deprecate' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.util-deprecate.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules\fsevents\node_modules\wrappy):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\wrappy' -> 'D:\rn
app\node_modules\fsevents\node_modules\.wrappy.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules\fsevents\node_modules\yallist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\yallist' -> 'D:\r
napp\node_modules\fsevents\node_modules\.yallist.DELETE'
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies your
self.
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies you
rself.
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.
6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})

然后我转到android文件夹并运行以下命令:

gradlew assemblerelease

但我明白了:

*

有人知道如何修复这个问题,并在这个空应用程序上为Android构建apk文件吗?

共有2个答案

单于善
2023-03-14

首先,您可以清理Gradle文件,然后使用此命令/gradlew AssemblereRelease

翟宾实
2023-03-14

这里有一个官方react本地网站的链接,展示了如何构建签名的android apk。

https://facebook.github.io/react-native/docs/signed-apk-android#__docusaurus

首先,您需要创建密钥库,下面是如何创建密钥库(https://stackoverflow.com/a/30254012/4829343)然后按照react native网站上的说明进行操作。

 类似资料:
  • 我的Android应用程序中有一个签名的zipaligned gradle文件。我使用的是Intellij13.1.4。我接收到的错误是错误:(34,0)找不到BuildTypedsl_Enterprise{Name=Release,Debuggable=False,JnideBugbuild=False,RenderScriptDebugbuild=False,RenderScriptOptim

  • 问题内容: 这不是让我输入我的名字,但是年龄确实可以。我知道我可以更改语句的顺序,但是还有另一种方法可以做到吗? 问题答案: 您的问题是,下一个int不考虑输入在您的姓名部分中的换行符。因此,名称返回为空白。 您可以通过两种方式更改代码: 要么 我个人喜欢第二种方式。

  • 我正在浏览https://ca.finance.yahoo.com/quote/aapl并想要得到股票价格的变化,绿色/红色文本。我已经能够刮除股票价格,但不能改变价值,因为他们位于相同的“div”类,但不同的“span”类。 我想要的文本:“-3.89(-1.36%)”-数字会有所不同 来自网站得HTML: 我用什么得到的价格:(282.80)-价格可能不同 我已经尝试了许多改变类名、span名

  • 节点6.11.2 NPM 4.6.1 反应-本机-CLI:2.0.1 React-Native:n/a-不在React本机项目目录中(???) MacOS 10.12.6 使用React Native从头开始创建一个新的应用程序。在我的Android和iOS设备上使用expo应用程序时,npm start就像一个魅力。我有麻烦为Android建立一个发行版apk。(iOS将是下一步。)我确实弹出了

  • 问题内容: 我的Android应用程序具有登录屏幕,并且用户登录到他的仪表板。但是我不希望用户每次关闭应用程序并启动时都进行登录(除非他们从仪表板上注销)。因此,我创建了一个类来检查用户是否登录 CheckLoggedIn.java 当用户登录时,我将布尔值更改为,并在注销时更改。但是,当我通过成功登录并关闭并再次启动进行检查时,它仍然进入LoginActivity。为什么? 编辑:现在,我明白这

  • 所以按照我编写的方式,它应该返回一个子字符串,该子字符串包含原始字符串中除最后一个字符以外的所有字符,从而通过递归每次删除字符串的一个字符。 我可以理解为什么这样做可能会有问题,因为当字符串长度为1或0时,没有什么可以告诉递归停止的,但由于问题是StackOverflowError而不是IndexOutOfBounds异常,我有点迷惑了。