- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 React Native 有一个奇怪的问题。我已经用几个版本的 RN 检查过它,例如 0.55.0 到 0.61.2,并尝试了几个解决方案,但没有一个解决了我的问题。问题是当我在我的真实设备(三星 s7 edge - android 8.0.0)上安装调试 apk 时,当 bundle 加载时,应用程序立即崩溃。但是,如果我安装已签名的发行版 apk,它就可以正常工作。它是如此有线。
例如我做了:
react-native init AwesomeProject
cd AwesomeProject
react-native run-android
然后应用程序立即崩溃,虽然它在模拟器上运行正常。
这是 logcat 日志:
10-23 00:39:14.840: D/StorageManagerService(3655): getExternalStorageMountMode : final mountMode=1, uid : 10821, packageName : com.awesomeproject
10-23 00:39:14.840: I/ApplicationPolicy(3655): isApplicationExternalStorageWhitelisted:com.awesomeproject user:0
10-23 00:39:14.840: D/ActivityManager(3655): package com.awesomeproject, user - 0 is SDcard whitelisted
10-23 00:39:14.840: I/ApplicationPolicy(3655): isApplicationExternalStorageBlacklisted:com.awesomeproject user:0
10-23 00:39:14.870: I/ActivityManager(3655): Start proc 22662:com.awesomeproject/u0a821 for activity com.awesomeproject/.MainActivity
10-23 00:39:14.877: I/SELinux(22662): SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.awesomeproject
10-23 00:39:14.953: I/ActivityManager(3655): START u0 {act=android.intent.action.MAIN typ=null flg=0x10200000 cmp=ComponentInfo{com.awesomeproject/com.awesomeproject.MainActivity}} from uid 10068
10-23 00:39:14.956: D/ActivityManagerPerformance(3655): Received MSG_CFMS_HINT_AMS_SWITCH pkgName: com.awesomeproject
10-23 00:39:14.967: D/ViewRootImpl@1d7ab40[awesomeproject](3655): setView = DecorView@d5d3be[awesomeproject] TM=true MM=false
10-23 00:39:14.967: D/ViewRootImpl@1d7ab40[awesomeproject](3655): setView = DecorView@d5d3be[awesomeproject] TM=true MM=false
10-23 00:39:14.971: I/ActivityManager(3655): DSS on for com.awesomeproject and scale is 1.0
10-23 00:39:14.973: V/WindowManager(3655): Relayout Window{2819a79 u0 Splash Screen com.awesomeproject}: viewVisibility=0 req=1080x1848 WM.LayoutParams{(0,0)(fillxfill) sim=#20 ty=3 fl=#81830118 pfl=0x20011 wanim=0x10302fd vsysui=0x600 needsMenuKey=2 colorMode=0 naviIconColor=0}
10-23 00:39:14.975: I/SurfaceFlinger(3197): id=592 createSurf (1080x1920),1 flag=404, Splash Screen com.awesomeproject#0
10-23 00:39:15.001: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{2819a79 u0 Splash Screen com.awesomeproject} in Surface(name=Splash Screen com.awesomeproject)
10-23 00:39:15.002: D/ActivityManager(3655): applyOptionsLocked, ANIM_CUSTOM_SCALE_UP, task.getRootActivity() : ActivityRecord{6b7a94b u0 com.awesomeproject/.MainActivity t9606}, task.getTaskToReturnTo() : 1
10-23 00:39:15.010: D/GameManagerService(3655): handleForegroundChange(). pkgName: com.awesomeproject, clsName: com.awesomeproject.MainActivity,FgActivityName:com.awesomeproject/.MainActivity
10-23 00:39:15.011: D/GameManagerService(3655): notifyResumePause(). pkg: com.awesomeproject, type: 4, isMinimized: false, isTunableApp: false
10-23 00:39:15.011: D/MARsPolicyManager(3655): onPackageResumedFG pkgName = com.awesomeproject, userId = 0
10-23 00:39:15.029: D/GamePkgDataHelper(3655): getGamePkgDataIncServer(). com.awesomeproject
10-23 00:39:15.029: D/GamePkgDataHelper(3655): getGamePkgDataIncServer(). com.awesomeproject
10-23 00:39:15.030: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
10-23 00:39:15.030: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
10-23 00:39:15.036: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
10-23 00:39:15.037: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
10-23 00:39:15.037: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
10-23 00:39:15.045: D/SoLoader(22662): adding application source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64 flags = 0]
10-23 00:39:15.046: D/SoLoader(22662): adding backup source from : com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject/lib-main flags = 1]
10-23 00:39:15.047: D/SoLoader(22662): Preparing SO source: com.facebook.soloader.DirectorySoSource[root = /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64 flags = 0]
10-23 00:39:15.047: D/SoLoader(22662): Preparing SO source: com.facebook.soloader.ApkSoSource[root = /data/data/com.awesomeproject/lib-main flags = 1]
10-23 00:39:15.048: V/fb-UnpackingSoSource(22662): locked dso store /data/user/0/com.awesomeproject/lib-main
10-23 00:39:15.050: I/fb-UnpackingSoSource(22662): dso store is up-to-date: /data/user/0/com.awesomeproject/lib-main
10-23 00:39:15.050: V/fb-UnpackingSoSource(22662): releasing dso store lock for /data/user/0/com.awesomeproject/lib-main
10-23 00:39:15.052: W/System.err(22662): at com.awesomeproject.MainApplication.initializeFlipper(MainApplication.java:61)
10-23 00:39:15.052: W/System.err(22662): at com.awesomeproject.MainApplication.onCreate(MainApplication.java:46)
10-23 00:39:15.053: W/System.err(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.flipper.ReactNativeFlipper" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
10-23 00:39:15.056: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
10-23 00:39:15.056: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
10-23 00:39:15.061: D/GameManagerService(3655): identifyGamePackage. com.awesomeproject
10-23 00:39:15.061: D/GamePkgDataHelper(3655): getGamePkgData(). com.awesomeproject
10-23 00:39:15.061: D/SurfaceFlinger(3197): HWC | 7df8a2dcc0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 112, 129, 828, 1402 | Splash Screen com.awesomeproject#0
10-23 00:39:15.090: D/SoLoader(22662): libjscexecutor.so not found on /data/data/com.awesomeproject/lib-main
10-23 00:39:15.090: D/SoLoader(22662): libjscexecutor.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
10-23 00:39:15.140: D/SurfaceFlinger(3197): GLES | 7df8a2dcc0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 27, 31, 1020, 1796 | Splash Screen com.awesomeproject#0
10-23 00:39:15.160: D/MdnieScenarioControlService(3655): packageName : com.awesomeproject className : com.awesomeproject.MainActivity
10-23 00:39:15.178: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
10-23 00:39:15.179: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
10-23 00:39:15.179: I/zygote64(22662): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk"],nativeLibraryDirectories=[/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64, /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/base.apk!/lib/arm64-v8a, /system/lib64, /system/vendor/lib64]]
10-23 00:39:15.226: V/WindowManager(3655): Relayout Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity}: viewVisibility=0 req=1080x1848 WM.LayoutParams{(0,0)(fillxfill) sim=#110 ty=1 fl=#81810100 pfl=0x20000 wanim=0x10302fd vsysui=0x600 needsMenuKey=2 colorMode=0 naviIconColor=0}
10-23 00:39:15.228: I/SurfaceFlinger(3197): id=593 createSurf (1080x1920),1 flag=404, com.awesomeproject/com.awesomeproject.MainActivity#0
10-23 00:39:15.242: D/libGLESv1(22662): STS_GLApi : DTS, ODTC are not allowed for Package : com.awesomeproject
10-23 00:39:15.261: V/InputMethodManager(22662): Starting input: tba=android.view.inputmethod.EditorInfo@3926903 nm : com.awesomeproject ic=null
10-23 00:39:15.262: V/InputMethodManagerService(3655): windowGainedFocus : reason=WINDOW_FOCUS_GAIN client=android.os.BinderProxy@927ec22 inputContext=null missingMethods= attribute=android.view.inputmethod.EditorInfo@e6b579c nm = com.awesomeproject controlFlags=#104 softInputMode=#110 windowFlags=#81810100
10-23 00:39:15.288: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity} in Surface(name=com.awesomeproject/com.awesomeproject.MainActivity)
10-23 00:39:15.293: D/InputEventReceiver(3655): channel '2819a79 Splash Screen com.awesomeproject (client)' ~ Disposing input event receiver.
10-23 00:39:15.293: D/InputEventReceiver(3655): channel '2819a79 Splash Screen com.awesomeproject (client)' ~NativeInputEventReceiver.
10-23 00:39:15.309: D/SurfaceFlinger(3197): HWC | 7df8a2dcc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 0, 0, 1080, 1920 | Splash Screen com.awesomeproject#0
10-23 00:39:15.318: V/InputMethodManager(22662): Starting input: tba=android.view.inputmethod.EditorInfo@ca7d080 nm : com.awesomeproject ic=null
10-23 00:39:15.325: D/SurfaceFlinger(3197): HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 0, 0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
10-23 00:39:15.325: I/WindowManager(3655): Destroying surface Surface(name=Splash Screen com.awesomeproject) called by com.android.server.wm.WindowStateAnimator.destroySurface:2501 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:985 com.android.server.wm.WindowState.destroyOrSaveSurfaceUnchecked:3680 com.android.server.wm.WindowState.destroySurface:3628 com.android.server.wm.AppWindowToken.destroySurfaces:722 com.android.server.wm.AppWindowToken.destroySurfaces:706 com.android.server.wm.WindowState.onExitAnimationDone:5335 com.android.server.wm.WindowStateAnimator.stepAnimationLocked:550
10-23 00:39:15.325: I/SurfaceFlinger(3197): id=592 Removed Splash Screen com.awesomeproject#0 (4/7)
10-23 00:39:15.331: I/SurfaceFlinger(3197): id=592 Removed Splash Screen com.awesomeproject#0 (-2/7)
10-23 00:39:15.337: I/Layer(3197): id=592 onRemoved Splash Screen com.awesomeproject#0
10-23 00:39:15.345: I/ActivityManager(3655): Displayed com.awesomeproject/.MainActivity: +361ms
10-23 00:39:15.355: D/SurfaceFlinger(3197): HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 0, 0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
10-23 00:39:15.440: D/SurfaceFlinger(3197): HWC | 7df47fddc0 | 0000 | 0020 | 00 | 0100 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 0, 0, 1080, 1920 | com.awesomeproject/com.awesomeproject.MainActivity#0
10-23 00:39:15.440: D/SoLoader(22662): libreactnativejni.so not found on /data/data/com.awesomeproject/lib-main
10-23 00:39:15.440: D/SoLoader(22662): libreactnativejni.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
10-23 00:39:15.443: D/SoLoader(22662): libfb.so not found on /data/data/com.awesomeproject/lib-main
10-23 00:39:15.443: D/SoLoader(22662): libfb.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
10-23 00:39:15.444: D/SoLoader(22662): libfb.so not found on /data/data/com.awesomeproject/lib-main
10-23 00:39:15.444: D/SoLoader(22662): libfb.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
10-23 00:39:15.444: I/zygote64(22662): Thread[24,tid=22718,Native,Thread*=0x7cfc286e00,peer=0x12fd5a20,"create_react_context"] recursive attempt to load library "/data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64/libfb.so"
10-23 00:39:15.489: D/MdnieScenarioControlService(3655): packageName : com.awesomeproject className : com.awesomeproject.MainActivity
10-23 00:39:15.629: D/SoLoader(22662): libyoga.so not found on /data/data/com.awesomeproject/lib-main
10-23 00:39:15.630: D/SoLoader(22662): libyoga.so found on /data/app/com.awesomeproject-EThs6uZ8OF5VI7aipjsTOg==/lib/arm64
10-23 00:39:16.055: A/DEBUG(22734): pid: 22662, tid: 22721, name: mqt_native_modu >>> com.awesomeproject <<<
10-23 00:39:17.162: W/ActivityManager(3655): crash : com.awesomeproject,0
10-23 00:39:17.163: W/ActivityManager(3655): Force finishing activity com.awesomeproject/.MainActivity
10-23 00:39:17.165: W/MultiScreenManagerService(3655): moveTaskBackToDisplayIfNeeded(): root activity or app is null, task=TaskRecord{9d01df6d0 #9606 A=com.awesomeproject U=0 StackId=1 sz=1}, rootActivity=null
10-23 00:39:17.173: I/ActivityManager(3655): Showing crash dialog for package com.awesomeproject u0
10-23 00:39:17.222: D/ViewRootImpl@21c7092[awesomeproject](3655): setView = DecorView@f14f719[awesomeproject] TM=true MM=false
10-23 00:39:17.241: V/WindowManager(3655): Relayout Window{da21660 u0 Application Error: com.awesomeproject}: viewVisibility=0 req=1015x442 WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 sim=#120 ty=2003 fl=#1820002 pfl=0x110 fmt=-3 wanim=0x10302ec surfaceInsets=Rect(6, 6 - 6, 6) needsMenuKey=2 colorMode=0 naviIconColor=0}
10-23 00:39:17.244: I/SurfaceFlinger(3197): id=595 createSurf (1027x454),1 flag=4, Application Error: com.awesomeproject#0
10-23 00:39:17.273: I/WindowManager(3655): WIN DEATH: Window{acc6470 u0 com.awesomeproject/com.awesomeproject.MainActivity}
10-23 00:39:17.274: I/WindowManager(3655): Destroying surface Surface(name=com.awesomeproject/com.awesomeproject.MainActivity) called by com.android.server.wm.WindowStateAnimator.destroySurface:2501 com.android.server.wm.WindowStateAnimator.destroySurfaceLocked:985 com.android.server.wm.WindowState.removeImmediately:2404 com.android.server.wm.WindowState.removeIfPossible:2606 com.android.server.wm.WindowState.-wrap1:0 com.android.server.wm.WindowState$DeathRecipient.binderDied:3151 android.os.BinderProxy.sendDeathNotice:843 <bottom of call stack>
10-23 00:39:17.278: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (1/6)
10-23 00:39:17.278: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (-2/6)
10-23 00:39:17.282: I/ActivityManager(3655): Process com.awesomeproject (pid 22662) has died: vis +99TOP (133,1567)
10-23 00:39:17.285: V/WindowManager(3655): finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{da21660 u0 Application Error: com.awesomeproject} in Surface(name=Application Error: com.awesomeproject)
10-23 00:39:17.286: I/SurfaceFlinger(3197): id=593 Removed com.awesomeproject/com.awesomeproject.MainActivity#0 (-2/6)
10-23 00:39:17.289: I/Layer(3197): id=593 onRemoved com.awesomeproject/com.awesomeproject.MainActivity#0
10-23 00:39:17.326: D/SurfaceFlinger(3197): GLES | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1027.0, 454.0 | 68, 787, 1010, 1204 | Application Error: com.awesomeproject#0
10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mServices
10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mProviders
10-23 00:39:17.334: D/PackageManager(3655): getComponentMetadataForIconTray : com.awesomeproject.MainActivity does not exist in mReceivers
10-23 00:39:17.335: D/ApplicationPackageManager(4073): updateItemMetaDataForFixedIconScale: package: com.awesomeproject
10-23 00:39:17.335: D/PackageManager(3655): getSelectedMetaData : packageName(com.awesomeproject) or Metadata strings {[Ljava.lang.String;@a4708a8}
10-23 00:39:17.336: I/ApplicationPackageManager(4073): load=com.awesomeproject, bg=144-144, dr=144-144, forDefault=true, density=0
10-23 00:39:17.338: I/ApplicationPackageManager(4073): load=com.awesomeproject-crop, bg=114-114, dr=144-144
10-23 00:39:17.341: W/PkgUtils(17655): p: com.awesomeproject, u:0
10-23 00:39:17.358: D/SurfaceFlinger(3197): GLES | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1027.0, 454.0 | 48, 778, 1031, 1213 | Application Error: com.awesomeproject#0
10-23 00:39:17.452: D/SurfaceFlinger(3197): 22, 767, 1058, 1225 | Application Error: com.awesomeproject#0
10-23 00:39:17.460: D/SurfaceFlinger(3197): HWC | 7df0377180 | 0000 | 0000 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1027.0, 454.0 | 20, 767, 1058, 1226 | Application Error: com.awesomeproject#0
10-23 00:39:21.455: D/SurfaceFlinger(3197): 5 | RGBA_8888 | 0.0, 0.0, 1027.0, 454.0 | 26, 769, 1053, 1223 | Application Error: com.awesomeproject#0
这是我的 package.json:
{
"name": "AwesomeProject",
"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 ."
},
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.2"
},
"devDependencies": {
"@babel/core": "^7.6.4",
"@babel/runtime": "^7.6.3",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
build.gradle:
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 16
compileSdkVersion = 28
targetSdkVersion = 28
}
repositories {
google()
jcenter()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
mavenLocal()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
google()
jcenter()
maven { url 'https://jitpack.io' }
}
}
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
* entryFile: "index.android.js",
*
* // https://facebook.github.io/react-native/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 = [
entryFile: "index.js",
enableHermes: false, // clean and rebuild if changing
]
apply from: "../../node_modules/react-native/react.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
}
defaultConfig {
applicationId "com.awesomeproject"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
splits {
abi {
reset()
enable enableSeparateBuildPerCPUArchitecture
universalApk false // If true, also generate a universal APK
include "armeabi-v7a", "x86", "arm64-v8a", "x86_64"
}
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://facebook.github.io/react-native/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"])
implementation "com.facebook.react:react-native:+" // From node_modules
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)
最佳答案
在为这个问题苦苦挣扎了 2 天之后,我终于找到了解决方案。我检查了每一行 logcat,并将其与 Release模式日志结合起来。我发现这些日志仅在应用程序崩溃时打印:
2019-10-23 16:55:21.774 17844-17896/com.awesomeproject D/ReactNative: ReactInstanceManager.attachRootViewToInstance()
2019-10-23 16:55:21.775 3655-3796/? D/MdnieScenarioControlService: packageName : com.awesomeproject className : com.awesomeproject.MainActivity
2019-10-23 16:55:21.782 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupViewManager
2019-10-23 16:55:21.783 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTGroupShadowNode
2019-10-23 16:55:21.787 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeViewManager
2019-10-23 16:55:21.788 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTShapeShadowNode
2019-10-23 16:55:21.790 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextViewManager
2019-10-23 16:55:21.791 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTTextShadowNode
2019-10-23 16:55:21.793 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.checkbox.ReactCheckBoxManager
2019-10-23 16:55:21.802 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.uimanager.LayoutShadowNode
2019-10-23 16:55:21.813 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDialogPickerManager
2019-10-23 16:55:21.818 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.drawer.ReactDrawerLayoutManager
2019-10-23 16:55:21.823 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.picker.ReactDropdownPickerManager
2019-10-23 16:55:21.826 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollViewManager
2019-10-23 16:55:21.835 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactHorizontalScrollContainerViewManager
2019-10-23 16:55:21.837 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ReactProgressBarViewManager
2019-10-23 16:55:21.839 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.progressbar.ProgressBarShadowNode
2019-10-23 16:55:21.842 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.scroll.ReactScrollViewManager
2019-10-23 16:55:21.849 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager
2019-10-23 16:55:21.852 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.slider.ReactSliderManager$ReactSliderShadowNode
2019-10-23 16:55:21.854 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager
2019-10-23 16:55:21.857 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.switchview.ReactSwitchManager$ReactSwitchShadowNode
2019-10-23 16:55:21.859 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.swiperefresh.SwipeRefreshLayoutManager
2019-10-23 16:55:21.864 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewManager
2019-10-23 16:55:21.865 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.art.ARTSurfaceViewShadowNode
2019-10-23 16:55:21.868 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageViewManager
2019-10-23 16:55:21.869 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.frescosupport.FrescoBasedReactTextInlineImageShadowNode
2019-10-23 16:55:21.873 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.image.ReactImageManager
2019-10-23 16:55:21.878 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ReactModalHostManager
2019-10-23 16:55:21.880 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.modal.ModalHostShadowNode
2019-10-23 16:55:21.882 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextManager
2019-10-23 16:55:21.883 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactRawTextShadowNode
2019-10-23 16:55:21.884 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputManager
2019-10-23 16:55:21.895 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.textinput.ReactTextInputShadowNode
2019-10-23 16:55:21.902 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextViewManager
2019-10-23 16:55:21.906 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactTextShadowNode
2019-10-23 16:55:21.908 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.view.ReactViewManager
2019-10-23 16:55:21.915 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.viewpager.ReactViewPagerManager
2019-10-23 16:55:21.918 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextViewManager
2019-10-23 16:55:21.918 17844-17896/com.awesomeproject W/unknown:ViewManagerPropertyUpdater: Could not find generated setter for class com.facebook.react.views.text.ReactVirtualTextShadowNode
根据一些研究,我发现问题出在 google play 服务上。我把它更新到最新版本,现在问题完全解决了。
关于android - clean react native 项目在真正的 android 设备 Debug模式下立即崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58512409/
假设我想在编译项目之前将项目本地依赖项(jar 文件)安装到本地 Maven 存储库 (~/.m2),这样我就可以在 POM 中引用它们,就像引用 Maven 中的任何依赖项一样中央。目前,我正在使用
我需要使用 Clean 编程语言列出目录中的所有文件,但我不知道这样做的任何函数。有人可以帮助我吗? 最佳答案 您可以使用 Directory module 中的函数 getDirectoryCont
我的应用程序工作正常,我能够使用 jar 执行 mvn clean install并能够执行 jar 文件,但我将其更改为 war 文件,但我无法执行 mvn clean install . 这些之间
我是 Maven 的初学者。当我点击 clean & Build 在 netbeans 中重建我的项目时,它抛出一个错误 Failed to execute goal org.apache.maven
我已经为我的一些模型覆盖了 clean() 方法来构造约束以满足我的数据库架构要求(因为它需要运行时信息来进行这些验证)。 从现在开始,我已经完成了大部分后端组件(模型、信号、..),现在我正在尝试编
从 Android Studio 项目的终端发出以下语句有什么区别: Android_Studio_Project_Path: ./gradlew clean Android_Studio_Proje
我曾在不同的团队工作过,在一个团队中,人们倾向于在合并旧分支后立即清理它们。在其他团队分支永远停留。删除/保留旧分支有什么好处?这是否取决于我们使用的源代码控制系统? (在我的情况下 - SVN)。
我有一个相当复杂的(iPhone SDK)Xcode 项目,有很多目标——4 个静态库、单元测试、多个示例应用程序、一个运行 shell 脚本的 BuildAll 以及一个运行另一个 shell 脚本
我有一个 cucumber 项目,当您单独运行 cucumberrunner 文件时,该项目运行良好 [运行方式 -->Junit 测试]。 当我尝试使用 maven 命令运行相同的文件时,它失败了:
我在 cruiseControl 中有一个 msbuild 任务,它首先清除然后重建。如果我将其更改为“清理并构建”(而不是重建),会有什么不同吗? Rebuild 为每个项目执行“清理 + 构建”。
我对 Clean Architecture 中的 Gateway to Entity 依赖有疑问。我认为以下同心圆图形经常被介绍为整洁的架构。 在上图中,Gateway并没有直视Entity。但是,还
我使用M2e + Eclipse + Maven,我想知道两者之间的区别: 在终端和中运行“mvn clean” 从Eclipse 运行“干净的项目”吗? 有人可以请教吗? 最佳答案 通过一些快速测试
我试图弄清楚 package.json 脚本部分中“clean:dist”或“clean:js”与“clean”的作用?我在网上搜索并查看了NPM documentation但找不到任何线索。那么有人
我在 Linux 上的构建过程有一个小问题。 无论出于何种原因,在我的代码中,如果我发出“make clean”命令,Linux 会生成一个名为“clean”的文件。问题是我的项目的 makefile
mvn clean package和mvn clean install到底有什么区别?当我运行这两个命令时,它们似乎都在做同样的事情。 最佳答案 好吧,两者都会清理。这意味着他们将删除目标文件夹。真正
您在每个应用程序的开发过程中都遇到了某个时刻,您在模拟器中看到的内容与您认为应该发生的情况不符。这些大多是人为错误——或者至少在大多数我的案例中是这样的;-)——但有时 Xcode 只是“迷失了方向”
我使用这两个命令来解决我项目中的依赖问题。 mvn -U clean compile解决的问题。但我不知道它们之间的区别。请解释这些命令之间的区别以及我何时使用 mvn clean compile和
我正在为我的项目使用 Maven。如果我的项目不使用某些本地资源,这不是问题。 以便我遵循本指南 https://stackoverflow.com/a/61576687/6720896 将我的本地
我正在尝试创建一个 Grunt 任务来清理目录中的所有文件、子目录及其文件等。 我可以删除所有文件,但文件夹始终保留。 clean: { preview: ["live_previe
我有以下情况: 我有一个包含几个子项目的项目。今天我尝试通过命令行使用 gradle 构建项目。 执行 ./gradlew clean :build 时构建成功, 但不是 ./gradlew clea
我是一名优秀的程序员,十分优秀!