Jan*_*nan 1 android react-native react-navigation
当我打开发布版本时,我收到以下错误。它在 IOS 和 Android 中都会发生。
E/AndroidRuntime:致命异常:mqt_native_modules进程:com.package.name,PID:28695 com.facebook.react.common.JavascriptException:ReferenceError:找不到变量:typeAnnotation,堆栈:@980:17088 v@2:1473 @979:425 v@2:1473 @978:339 v@2:1473 @971:6338 v@2:1473 @970:139 v@2:1473 @969:218 v@2:1473 @968:117 v @2:1473 @882:1330 v@2:1473 @545:542 v@2:1473 @406:344 v@2:1473 @6:57 v@2:1473 d@2:875 全局代码@1766: 3 在 com.facebook.react.modules.core.ExceptionsManagerModule.reportException(ExceptionsManagerModule.java:83) 在 java.lang.reflect.Method.invoke(本机方法) 在 com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper .java:372)在com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)在com.facebook.react.bridge.queue.NativeRunnable.run(本机方法)在android.os.Handler.handleCallback (Handler.java:789) 在 android.os.Handler.dispatchMessage(Handler.java:98) 在 com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27) 在 android.os.Looper。循环(Looper.java:164)在com.facebook.react.bridge.queue.MessageQueueThreadImpl $ 4.run(MessageQueueThreadImpl.java:226)在java.lang.Thread.run(Thread.java:764)
项目信息
System:
OS: macOS 11.0.1
CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 111.48 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 10.16.3 - /usr/local/bin/node
Yarn: 1.22.5 - /usr/local/bin/yarn
npm: 6.14.10 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1
Android SDK:
API Levels: 23, 24, 25, 26, 27, 28, 29
Build Tools: 19.1.0, 20.0.0, 21.1.2, 22.0.1, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.0, 28.0.1, 28.0.2, 28.0.3, 29.0.0, 29.0.1, 29.0.2, 29.0.3, 30.0.0, 30.0.3
System Images: android-26 | Intel x86 Atom, android-26 | Google APIs Intel x86 Atom, android-26 | Google Play Intel x86 Atom, android-27 | Intel x86 Atom, android-27 | Google APIs Intel x86 Atom, android-28 | Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-29 | Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.2/12B45b - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_221 - /usr/bin/javac
Python: 2.7.16 - /usr/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: ^0.63.3 => 0.63.4
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Run Code Online (Sandbox Code Playgroud)
包.json
{
"name": "AwrStarterKit",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint .",
"ios-build:dev": "gulp set --env=dev && react-native run-ios",
"ios-build:test": "gulp set --env=test && react-native run-ios",
"ios-build:prod": "gulp set --env=prod && react-native run-ios",
"android-build:dev": "gulp set --env=dev && react-native run-android",
"android-build:test": "gulp set --env=test && react-native run-android",
"android-build:prod": "gulp set --env=test && react-native run-android",
"android-releaseBuild:test": "gulp set --env=test && cd android && ./gradlew assembleRelease",
"android-releaseBuild:prod": "gulp set --env=test && cd android && ./gradlew clean && ./gradlew assembleRelease",
"android-clean": "cd android && ./gradlew clean",
"generate": "plop"
},
"dependencies": {
"@notifee/react-native": "^0.13.2",
"@react-native-community/async-storage": "^1.12.0",
"@react-native-community/geolocation": "^2.0.2",
"@react-native-community/masked-view": "^0.1.10",
"@react-native-community/netinfo": "^5.9.7",
"@react-native-community/toolbar-android": "^0.1.0-rc.2",
"@react-native-firebase/analytics": "^7.6.7",
"@react-native-firebase/app": "^8.4.3",
"@react-native-firebase/crashlytics": "^8.4.9",
"@react-native-firebase/messaging": "^7.8.11",
"@react-navigation/bottom-tabs": "^5.9.0",
"@react-navigation/compat": "^5.2.8",
"@react-navigation/native": "^5.7.4",
"@react-navigation/stack": "^5.9.1",
"axios": "^0.20.0",
"firebase": "^7.22.0",
"fs": "^0.0.1-security",
"gulp": "^4.0.2",
"gulp-clean": "^0.4.0",
"gulp-rename": "^2.0.0",
"i18n-js": "^3.7.1",
"js-base64": "^3.5.2",
"js-pascalcase": "^1.2.1",
"lodash.memoize": "^4.1.2",
"moment": "^2.29.1",
"plop": "^2.7.4",
"react": "16.13.1",
"react-native": "^0.63.3",
"react-native-af-video-player": "^0.2.1",
"react-native-android-location-enabler": "^1.2.1",
"react-native-aws3": "^0.0.9",
"react-native-calendar-events": "^2.1.0",
"react-native-camera": "^3.40.0",
"react-native-config": "^1.3.3",
"react-native-dash": "^0.0.11",
"react-native-datepicker": "^1.7.2",
"react-native-device-info": "^6.1.0",
"react-native-event-listeners": "^1.0.7",
"react-native-exception-handler": "^2.10.8",
"react-native-fast-image": "^8.3.3",
"react-native-fs": "^2.16.6",
"react-native-gesture-handler": "^1.9.0",
"react-native-google-places-autocomplete": "^1.9.0",
"react-native-highlight-words": "^1.0.1",
"react-native-hyperlink": "^0.0.19",
"react-native-i18n": "^2.0.15",
"react-native-image-crop-picker": "^0.35.0",
"react-native-image-gallery": "^2.1.5",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-picker": "^2.3.4",
"react-native-keep-awake": "^4.0.0",
"react-native-linear-gradient": "^2.5.6",
"react-native-localize": "^1.4.1",
"react-native-map-link": "^2.7.19",
"react-native-maps": "^0.27.1",
"react-native-modal": "^11.5.6",
"react-native-mov-to-mp4": "^0.2.2",
"react-native-orientation": "^3.1.3",
"react-native-pdf": "^6.2.1",
"react-native-permissions": "^2.2.2",
"react-native-photo-view-ex": "^1.1.0",
"react-native-progress": "^4.1.2",
"react-native-reanimated": "^1.13.2",
"react-native-render-html": "^4.2.4",
"react-native-restart": "^0.0.17",
"react-native-safe-area-context": "^3.1.9",
"react-native-screens": "^2.16.1",
"react-native-splash-screen": "^3.2.0",
"react-native-swiper": "^1.6.0",
"react-native-thumbnail": "^1.1.3",
"react-native-touch-id": "^4.4.1",
"react-native-vector-icons": "^7.1.0",
"react-native-version-number": "^0.3.6",
"react-native-video": "^5.1.0-alpha8",
"react-native-view-overflow": "^0.0.5",
"react-native-webview": "^10.9.0",
"react-navigation": "^4.4.1",
"react-navigation-transitions": "^1.0.12",
"react-redux": "^7.2.1",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-promise-middleware": "^6.1.2",
"redux-thunk": "^2.3.0",
"rn-fetch-blob": "^0.12.0",
"stacktrace-js": "^2.0.2"
},
"devDependencies": {
"@babel/core": "^7.8.4",
"@babel/runtime": "^7.8.4",
"@react-native-community/eslint-config": "^1.1.0",
"babel-jest": "^25.1.0",
"eslint": "^6.5.1",
"jest": "^25.1.0",
"metro-react-native-babel-preset": "^0.59.0",
"react-test-renderer": "16.13.1"
},
"jest": {
"preset": "react-native"
},
"react-native": {
"zlib": "browserify-zlib",
"console": "console-browserify",
"constants": "constants-browserify",
"crypto": "react-native-crypto",
"dns": "dns.js",
"net": "react-native-tcp",
"domain": "domain-browser",
"http": "@tradle/react-native-http",
"https": "https-browserify",
"os": "react-native-os",
"path": "path-browserify",
"querystring": "querystring-es3",
"fs": "react-native-level-fs",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"dgram": "react-native-udp",
"stream": "stream-browserify",
"timers": "timers-browserify",
"tty": "tty-browserify",
"vm": "vm-browserify",
"tls": false
},
"browser": {
"zlib": "browserify-zlib",
"console": "console-browserify",
"constants": "constants-browserify",
"crypto": "react-native-crypto",
"dns": "dns.js",
"net": "react-native-tcp",
"domain": "domain-browser",
"http": "@tradle/react-native-http",
"https": "https-browserify",
"os": "react-native-os",
"path": "path-browserify",
"querystring": "querystring-es3",
"fs": "react-native-level-fs",
"_stream_transform": "readable-stream/transform",
"_stream_readable": "readable-stream/readable",
"_stream_writable": "readable-stream/writable",
"_stream_duplex": "readable-stream/duplex",
"_stream_passthrough": "readable-stream/passthrough",
"dgram": "react-native-udp",
"stream": "stream-browserify",
"timers": "timers-browserify",
"tty": "tty-browserify",
"vm": "vm-browserify",
"tls": false
}
}
Run Code Online (Sandbox Code Playgroud)
构建 Gradle
应用程序/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
* and bundleReleaseJsAndAssets).
* These basically call `react-native bundle` with the correct arguments during the Android build
* cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the
* bundle directly from the development server. Below you can see all the possible configurations
* and their defaults. If you decide to add a configuration block, make sure to add it before the
* `apply from: "../../node_modules/react-native/react.gradle"` line.
*
* project.ext.react = [
* // the name of the generated asset file containing your JS bundle
* bundleAssetName: "index.android.bundle",
*
* // the entry file for bundle generation. If none specified and
* // "index.android.js" exists, it will be used. Otherwise "index.js" is
* // default. Can be overridden with ENTRY_FILE environment variable.
* entryFile: "index.android.js",
*
* // https://reactnative.dev/docs/performance#enable-the-ram-format
* bundleCommand: "ram-bundle",
*
* // whether to bundle JS and assets in debug mode
* bundleInDebug: false,
*
* // whether to bundle JS and assets in release mode
* bundleInRelease: true,
*
* // whether to bundle JS and assets in another build variant (if configured).
* // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants
* // The configuration property can be in the following formats
* // 'bundleIn${productFlavor}${buildType}'
* // 'bundleIn${buildType}'
* // bundleInFreeDebug: true,
* // bundleInPaidRelease: true,
* // bundleInBeta: true,
*
* // whether to disable dev mode in custom build variants (by default only disabled in release)
* // for example: to disable dev mode in the staging build type (if configured)
* devDisabledInStaging: true,
* // The configuration property can be in the following formats
* // 'devDisabledIn${productFlavor}${buildType}'
* // 'devDisabledIn${buildType}'
*
* // the root of your project, i.e. where "package.json" lives
* root: "../../",
*
* // where to put the JS bundle asset in debug mode
* jsBundleDirDebug: "$buildDir/intermediates/assets/debug",
*
* // where to put the JS bundle asset in release mode
* jsBundleDirRelease: "$buildDir/intermediates/assets/release",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in debug mode
* resourcesDirDebug: "$buildDir/intermediates/res/merged/debug",
*
* // where to put drawable resources / React Native assets, e.g. the ones you use via
* // require('./image.png')), in release mode
* resourcesDirRelease: "$buildDir/intermediates/res/merged/release",
*
* // by default the gradle tasks are skipped if none of the JS files or assets change; this means
* // that we don't look at files in android/ or ios/ to determine whether the tasks are up to
* // date; if you have any other folders that you want to ignore for performance reasons (gradle
* // indexes the entire tree), add them here. Alternatively, if you have JS files in android/
* // for example, you might want to remove it from here.
* inputExcludes: ["android/**", "ios/**"],
*
* // override which node gets called and with what additional arguments
* nodeExecutableAndArgs: ["node"],
*
* // supply additional arguments to the packager
* extraPackagerArgs: []
* ]
*/
project.ext.react = [
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.gradle"
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
/**
* Set this to true to create two separate APKs instead of one:
* - An APK that only works on ARM devices
* - An APK that only works on x86 devices
* The advantage is the size of the APK is reduced by about 4MB.
* Upload all the APKs to the Play Store and people will download
* the correct one based on the CPU architecture of their device.
*/
def enableSeparateBuildPerCPUArchitecture = false
/**
* Run Proguard to shrink the Java bytecode in release builds.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore.
*
* For example, to use the international variant, you can use:
* `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'org.webkit:android-jsc:+'
/**
* Whether to enable the Hermes VM.
*
* This should be set on project.ext.react and mirrored here. If it is not set
* on project.ext.react, JavaScript will not be compiled to Hermes Bytecode
* and the benefits of using Hermes will therefore be sharply reduced.
*/
def enableHermes = project.ext.react.get("enableHermes", false);
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
checkReleaseBuilds false
}
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
}
defaultConfig {
applicationId "com.packageName"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode project.env.get("ANDROID_VERSION_CODE").toInteger()
versionName project.env.get("ANDROID_VERSION_NAME")
missingDimensionStrategy 'react-native-camera', 'general'
multiDexEnabled true
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
}
release {
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// https://developer.android.com/studio/build/configure-apk-splits.html
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
//noinspection GradleDynamicVersion
implementation "com.facebook.react:react-native:+" // From node_modules
implementation 'androidx.multidex:multidex:2.0.1'
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"
// implementation 'com.android.support:support-annotations:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0' // implementation 'androidx.appcompat:appcompat:1.0.2'
// implementation 'androidx.annotation:annotation:1.0.2'
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'
implementation 'com.google.firebase:firebase-analytics:17.5.0'
implementation 'com.google.firebase:firebase-crashlytics:17.2.2'
implementation "com.google.android.gms:play-services-base:16.1.0"
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-messaging:20.3.0'
implementation "com.google.android.gms:play-services-gcm:12.+"
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}
if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
// Google Play services Gradle plugin
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
Run Code Online (Sandbox Code Playgroud)
小智 5
尝试在您的代码中查找类似 @babel/types 的内容;对我来说,就是删除import { exportDefaultSpecifier } from '@babel/types';然后一切正常
| 归档时间: |
|
| 查看次数: |
809 次 |
| 最近记录: |