描述
React Native0.74.3
构建发布包
"apk": "cd android && ./gradlew aR",
"aab": "cd android && ./gradlew bundleRelease"
打包成功,程序可以正常使用,但输出了许多警告
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:1322:18: warning: the variable "DebuggerInternal" was not declared in function "__shouldPauseOnThrow"
typeof DebuggerInternal !== 'undefined' &&
^~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:6550:7: warning: the variable "setTimeout" was not declared in function "logCapturedError"
setTimeout(function () {
^~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:4660:31: warning: the variable "nativeFabricUIManager" was not declared in anonymous function " 133#"
var _nativeFabricUIManage = nativeFabricUIManager,
^~~~~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:4688:21: warning: the variable "clearTimeout" was not declared in anonymous function " 133#"
cancelTimeout = clearTimeout;
^~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:9318:30: warning: the variable "REACT_DEVTOOLS_GLOBAL_HOOK" was not declared in anonymous function " 133#"
if ("undefined" !== typeof REACT_DEVTOOLS_GLOBAL_HOOK) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:11730:5: warning: the variable "setImmediate" was not declared in function "handleResolved"
setImmediate(function () {
^~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16001:12: warning: the variable "fetch" was not declared in anonymous function " 369#"
fetch: fetch,
^~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16002:14: warning: the variable "Headers" was not declared in anonymous function " 369#"
Headers: Headers,
^~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16003:14: warning: the variable "Request" was not declared in anonymous function " 369#"
Request: Request,
^~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16004:15: warning: the variable "Response" was not declared in anonymous function " 369#"
Response: Response
^~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16161:24: warning: the variable "FileReader" was not declared in function "readBlobAsArrayBuffer"
var reader = new FileReader();
^~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16212:36: warning: the variable "Blob" was not declared in anonymous function
" 380#"
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
^~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16214:40: warning: the variable "FormData" was not declared in anonymous function " 380#"
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
^~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16216:44: warning: the variable "URLSearchParams" was not declared in anonymous function " 380#"
...e if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body...
^~~~~~~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16335:26: warning: the variable "AbortController" was not declared in anonymous function " 386#"
var ctrl = new AbortController();
^~~~~~~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets
^~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:26422:34: warning: the variable "nativeRuntimeScheduler" was not declared in anonymous function " 685#"
... = "undefined" !== typeof nativeRuntimeScheduler ? nativeRuntimeScheduler....
^~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:35520:34: warning: the variable "requestAnimationFrame" was not declared in function "start 9#"
... this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));
^~~~~~~~~~~~~~~~~~~~~
Steps to reproduce
1 Set up development environment
2 Configure Android environment and run successfully
3 Configuration packaging (release)
These warnings will not be prompted in the development environment, only in the production environment
React Native Version
0.74.3
Affected Platforms
Runtime - Android, Build - Windows
Areas
Other (please specify)
Output of npx react-native info
windwo 10
android
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.22"
node 18.20.4
Stacktrace or Logs
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:1322:18: warning: the variable "DebuggerInternal" was not declared in function "__shouldPauseOnThrow"
typeof DebuggerInternal !== 'undefined' &&
^~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:6550:7: warning: the variable "setTimeout" was not declared in function "logCapturedError"
setTimeout(function () {
^~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:4660:31: warning: the variable "nativeFabricUIManager" was not declared in anonymous function " 133#"
var _nativeFabricUIManage = nativeFabricUIManager,
^~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:4688:21: warning: the variable "clearTimeout" was not declared in anonymous function " 133#"
cancelTimeout = clearTimeout;
^~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:9318:30: warning: the variable "__REACT_DEVTOOLS_GLOBAL_HOOK__" was not declared in anonymous function " 133#"
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:11730:5: warning: the variable "setImmediate" was not declared in function "handleResolved"
setImmediate(function () {
^~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16001:12: warning: the variable "fetch" was not declared in anonymous function " 369#"
fetch: fetch,
^~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16002:14: warning: the variable "Headers" was not declared in anonymous function " 369#"
Headers: Headers,
^~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16003:14: warning: the variable "Request" was not declared in anonymous function " 369#"
Request: Request,
^~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16004:15: warning: the variable "Response" was not declared in anonymous function " 369#"
Response: Response
^~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16161:24: warning: the variable "FileReader" was not declared in function "readBlobAsArrayBuffer"
var reader = new FileReader();
^~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16212:36: warning: the variable "Blob" was not declared in anonymous function
" 380#"
} else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
^~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16214:40: warning: the variable "FormData" was not declared in anonymous function " 380#"
} else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
^~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16216:44: warning: the variable "URLSearchParams" was not declared in anonymous function " 380#"
...e if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body...
^~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16335:26: warning: the variable "AbortController" was not declared in anonymous function " 386#"
var ctrl = new AbortController();
^~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16469:23: warning: the variable "XMLHttpRequest" was not declared in anonymous function " 390#"
var xhr = new XMLHttpRequest();
^~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:16014:71: warning: the variable "self" was not declared in anonymous function
" 372#"
...undefined' && globalThis || typeof self !== 'undefined' && self ||
^~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:26274:27: warning: the variable "performance" was not declared in anonymous function " 685#"
if ("object" === typeof performance && "function" === typeof performance.no...
^~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:26297:26: warning: the variable "navigator" was not declared in anonymous function " 685#"
"undefined" !== typeof navigator && undefined !== navigator.scheduling && u...
^~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:26407:37: warning: the variable "MessageChannel" was not declared in anonymous function " 685#"
};else if ("undefined" !== typeof MessageChannel) {
^~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:26422:34: warning: the variable "nativeRuntimeScheduler" was not declared in anonymous function " 685#"
... = "undefined" !== typeof nativeRuntimeScheduler ? nativeRuntimeScheduler....
^~~~~~~~~~~~~~~~~~~~~~
android\app\build\generated\assets\createBundleReleaseJsAndAssets\index.android.bundle:35520:34: warning: the variable "requestAnimationFrame" was not declared in function "start 9#"
... this._animationFrame = requestAnimationFrame(this.onUpdate.bind(this));
^~~~~~~~~~~~~~~~~~~~~
Reproducer
.
7条答案
按热度按时间gk7wooem1#
jtw3ybtb2#
iyfamqjs3#
https://github.com/FTW-001/rn/tree/main/ReproducerApp
af7jpaap4#
8ljdwjyq5#
这些都是警告,不应该影响您的正常开发。@FTW-001
guz6ccqo6#
是的,这并不影响程序的运行和使用,但我无法确定这些警告的原因或是否存在任何潜在危险,所以我想了解更多信息。
wz3gfoph7#
是的,这并不影响程序的运行和使用,但我无法确定这些警告的原因或是否存在任何隐藏的危险,所以我想了解更多。
这些警告是由Metro发出的,针对React Native内部的源代码。
您非常欢迎修复它们并提交PR,我们将非常乐意合并它