我在 React Native 应用程序上将 Android SDK 升级到了 34。它在调试模式下工作得很好,但后来我发现每个 Android 客户端在生产中都会崩溃。我花了几个小时进行调试和谷歌搜索,但没有任何效果。我怀疑这是因为我升级了 Gradle,因此它不再知道如何打包应用程序。以下是我升级时的一些相关更改:
import java.lang.reflect.InvocationTargetException;
import java.util.List;
import com.reactnativecommunity.cameraroll.CameraRollPackage;
import android.content.BroadcastReceiver;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Build;
import org.jetbrains.annotations.Nullable;
public class MainApplication extends Application implements ReactApplication {
@Override
public Intent registerReceiver(@Nullable BroadcastReceiver receiver, IntentFilter filter) {
if (Build.VERSION.SDK_INT >= 34 && getApplicationInfo().targetSdkVersion >= 34) {
return super.registerReceiver(receiver, filter, Context.RECEIVER_EXPORTED);
} else {
return super.registerReceiver(receiver, filter);
}
}
tasks.withType(JavaCompile) {
options.compilerArgs += ["-Xlint:deprecation", "-Xlint:unchecked"]
}
当我测试各种解决方案时,我已经 git stshed 并运行 gradlew clean 和 gradlew assembleRelease,然后我使用 adb install 将应用程序移动到那里。
错误日志:
07-31 13:49:04.775 5030 5079 D Launcher.Model: Loader.updatePackage com.mycompany.myapp
07-31 13:49:04.778 5030 5079 V LauncherApps: Returning activity for profile UserHandle{0} : ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}
07-31 13:49:04.790 3631 4052 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mServices
07-31 13:49:04.790 3631 4052 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mProviders
07-31 13:49:04.790 3631 4052 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mReceivers
07-31 13:49:04.792 3631 4052 D PackageManager: getSelectedMetaData : packageName(com.mycompany.myapp) or Metadata strings {[Ljava.lang.String;@7128e06}
07-31 13:49:04.800 5030 5079 D LauncherActivityInfo: packageName: com.mycompany.myapp, supportTheme: false, height: 192, width: 192, density: 640
07-31 13:49:04.824 5030 5079 V LauncherApps: Returning activity for profile UserHandle{0} : ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}
07-31 13:49:04.824 5030 5079 D DataLoader: updatePackage:com.mycompany.myapp
07-31 13:49:04.826 5030 5079 I AppsModel: addOrUpdater cn = ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity} , UserHandle{0}
07-31 13:49:04.827 5030 5079 I AppsModel: addOrUpdater update item = IconInfo(title=myapp intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.mycompany.myapp/.MainActivity (has extras) } id=129 type=0 container=-102 screen=1 cellX=3 cellY=2 spanX=1 spanY=1 rank=11 hidden=0 dropPos=null user=UserHandle{0})
07-31 13:49:04.828 5030 5030 D AppsAdapter: updateItem : (id=129, container=-102, screen=1, rank=11, myapp, false)
07-31 13:49:04.830 5030 5079 I PostPositionController: addItem() - com.mycompany.myapp, isWidgetOnly : true
07-31 13:49:08.601 3631 7968 I ActivityManager: START u0 {act=android.intent.action.MAIN typ=null flg=0x10200000 cmp=ComponentInfo{com.mycompany.myapp/com.mycompany.myapp.MainActivity}} from uid 10008
07-31 13:49:08.602 3631 4729 D ActivityManagerPerformance: Received MSG_CFMS_HINT_AMS_SWITCH pkgName: com.mycompany.myapp
07-31 13:49:08.615 3631 3722 D ViewRootImpl@bd5a48d[myapp]: setView = DecorView@eb36653[myapp] TM=true MM=false
07-31 13:49:08.621 3631 4052 D ActivityManager: applyOptionsLocked, ANIM_CUSTOM_SCALE_UP, task.getRootActivity() : ActivityRecord{c96ac8c u0 com.mycompany.myapp/.MainActivity t871}, task.getTaskToReturnTo() : 1
07-31 13:49:08.622 3631 4052 D StorageManagerService: getExternalStorageMountMode : final mountMode=1, uid : 10212, packageName : com.mycompany.myapp
07-31 13:49:08.622 3631 4052 I ApplicationPolicy: isApplicationExternalStorageWhitelisted:com.mycompany.myapp user:0
07-31 13:49:08.622 3631 4052 D ActivityManager: package com.mycompany.myapp, user - 0 is SDcard whitelisted
07-31 13:49:08.622 3631 4052 I ApplicationPolicy: isApplicationExternalStorageBlacklisted:com.mycompany.myapp user:0
07-31 13:49:08.626 3631 3722 D ViewRootImpl@bd5a48d[myapp]: dispatchAttachedToWindow
07-31 13:49:08.626 3631 3722 V WindowManager: Relayout Window{4283642 u0 Splash Screen com.mycompany.myapp}: 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}
07-31 13:49:08.628 3194 3194 I SurfaceFlinger: id=188 createSurf (1080x1920),1 flag=404, Splash Screen com.mycompany.myapp#0
07-31 13:49:08.631 3631 3722 D ViewRootImpl@bd5a48d[myapp]: Relayout returned: old=[0,0][0,0] new=[0,0][1080,1920] result=0x7 surface={valid=true 515257561088} changed=true
07-31 13:49:08.633 3631 4052 I ActivityManager: Start proc 17500:com.mycompany.myapp/u0a212 for activity com.mycompany.myapp/.MainActivity
07-31 13:49:08.637 17500 17500 I SELinux : SELinux: seapp_context_lookup: seinfo=untrusted, level=s0:c512,c768, pkgname=com.mycompany.myapp
07-31 13:49:08.651 3631 4052 I ActivityManager: DSS on for com.mycompany.myapp and scale is 1.0
07-31 13:49:08.653 3631 3722 V WindowManager: finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{4283642 u0 Splash Screen com.mycompany.myapp} in Surface(name=Splash Screen com.mycompany.myapp)
07-31 13:49:08.662 3631 3920 D GameManagerService: handleForegroundChange(). pkgName: com.mycompany.myapp, clsName: com.mycompany.myapp.MainActivity,FgActivityName:com.mycompany.myapp/.MainActivity
07-31 13:49:08.663 3631 3920 D GameManagerService: notifyResumePause(). pkg: com.mycompany.myapp, type: 4, isMinimized: false, isTunableApp: false
07-31 13:49:08.663 3631 4052 D MARsPolicyManager: onPackageResumedFG pkgName = com.mycompany.myapp, userId = 0
07-31 13:49:08.668 3631 7671 D GamePkgDataHelper: getGamePkgDataIncServer(). com.mycompany.myapp
07-31 13:49:08.669 3631 7671 D GameManagerService: identifyGamePackage. com.mycompany.myapp
07-31 13:49:08.669 3631 7671 D GamePkgDataHelper: getGamePkgData(). com.mycompany.myapp
07-31 13:49:08.669 3631 7671 D GameManagerService: identifyGamePackage. com.mycompany.myapp
07-31 13:49:08.669 3631 7671 D GamePkgDataHelper: getGamePkgData(). com.mycompany.myapp
07-31 13:49:08.670 3631 7671 D GameManagerService: identifyGamePackage. com.mycompany.myapp
07-31 13:49:08.670 3631 7671 D GamePkgDataHelper: getGamePkgData(). com.mycompany.myapp
07-31 13:49:08.671 3631 7671 D GameManagerService: identifyGamePackage. com.mycompany.myapp
07-31 13:49:08.671 3631 7671 D GamePkgDataHelper: getGamePkgData(). com.mycompany.myapp
07-31 13:49:08.673 3631 7671 D GameManagerService: identifyGamePackage. com.mycompany.myapp
07-31 13:49:08.673 3631 7671 D GamePkgDataHelper: getGamePkgData(). com.mycompany.myapp
07-31 13:49:08.717 3194 3194 D SurfaceFlinger: GLES | 70a05848c0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 313, 349, 1029, 1622 | Splash Screen com.mycompany.myapp#0
07-31 13:49:08.747 3631 4052 D PackageManager: setEnabledSetting : userId = 0 packageName = com.mycompany.myapp cmp = androidx.work.impl.background.systemjob.SystemJobService newState = 1 callingPackage = 10212/com.mycompany.myapp
07-31 13:49:08.798 17500 17500 D SoLoader: libjscexecutor.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.798 17500 17500 D SoLoader: libjscexecutor.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.798 3631 3772 D MdnieScenarioControlService: packageName : com.mycompany.myapp className : com.mycompany.myapp.MainActivity
07-31 13:49:08.799 17500 17500 E SoLoader: SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64 flags = 0]
07-31 13:49:08.799 17500 17500 E SoLoader: SoSource 1: com.facebook.soloader.DirectApkSoSource[root = /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a]
07-31 13:49:08.799 17500 17500 E SoLoader: Native lib dir: /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.799 17500 17500 D SoLoader: libhermes.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.802 17500 17500 D SoLoader: liblog.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.802 17500 17500 D SoLoader: liblog.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.802 17500 17500 D SoLoader: libm.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.802 17500 17500 D SoLoader: libm.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.802 17500 17500 D SoLoader: libdl.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.803 17500 17500 D SoLoader: libdl.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.803 17500 17500 D SoLoader: libc.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.803 17500 17500 D SoLoader: libc.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.811 17500 17500 D SoLoader: libhermes-executor-debug.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.811 17500 17500 D SoLoader: libhermes-executor-debug.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.811 17500 17500 E SoLoader: SoSource 0: com.facebook.soloader.DirectorySoSource[root = /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64 flags = 0]
07-31 13:49:08.811 17500 17500 E SoLoader: SoSource 1: com.facebook.soloader.DirectApkSoSource[root = /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a]
07-31 13:49:08.811 17500 17500 E SoLoader: Native lib dir: /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.811 17500 17500 D SoLoader: libhermes-executor-release.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.861 17500 17524 D SoLoader: libfbjni.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.863 17500 17524 D SoLoader: libandroid.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.863 17500 17524 D SoLoader: libandroid.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/base.apk!/lib/arm64-v8a
07-31 13:49:08.886 17500 17524 D SoLoader: libreactnativejni.so not found on /data/app/com.mycompany.myapp-VSWi83B1RNj2nuqCcKLp5w==/lib/arm64
07-31 13:49:08.896 3631 4052 V WindowManager: Relayout Window{28a4b9a u0 com.mycompany.myapp/com.mycompany.myapp.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}
07-31 13:49:08.901 17500 17524 E AndroidRuntime: Process: com.mycompany.myapp, PID: 17500
07-31 13:49:08.901 3194 3194 I SurfaceFlinger: id=189 createSurf (1080x1920),1 flag=404, com.mycompany.myapp/com.mycompany.myapp.MainActivity#0
07-31 13:49:08.903 3631 5018 W ActivityManager: crash : com.mycompany.myapp,0
07-31 13:49:08.905 3631 5018 W ActivityManager: Force finishing activity com.mycompany.myapp/.MainActivity
07-31 13:49:08.905 3631 5018 W MultiScreenManagerService: moveTaskBackToDisplayIfNeeded(): root activity or app is null, task=TaskRecord{b074ccbd0 #871 A=com.mycompany.myapp U=0 StackId=1 sz=1}, rootActivity=null
07-31 13:49:08.912 17500 17527 D libGLESv1: STS_GLApi : DTS, ODTC are not allowed for Package : com.mycompany.myapp
07-31 13:49:08.922 3631 3655 I ActivityManager: Showing crash dialog for package com.mycompany.myapp u0
07-31 13:49:08.936 3194 3194 D SurfaceFlinger: GLES | 70a05848c0 | 0000 | 0021 | 00 | 0100 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 0, 0, 1080, 1920 | Splash Screen com.mycompany.myapp#0
07-31 13:49:08.968 3631 3655 D ViewRootImpl@cedd1c[myapp]: setView = DecorView@a530cab[myapp] TM=true MM=false
07-31 13:49:08.969 3631 3655 D ViewRootImpl@cedd1c[myapp]: dispatchAttachedToWindow
07-31 13:49:08.970 3631 5147 V WindowManager: finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{28a4b9a u0 com.mycompany.myapp/com.mycompany.myapp.MainActivity} in Surface(name=com.mycompany.myapp/com.mycompany.myapp.MainActivity)
07-31 13:49:08.971 17139 17157 W PkgUtils: p: com.mycompany.myapp, u:0
07-31 13:49:08.976 17500 17500 V InputMethodManager: Starting input: tba=android.view.inputmethod.EditorInfo@7cbcba5 nm : com.mycompany.myapp ic=null
07-31 13:49:08.979 3631 3722 D ViewRootImpl@bd5a48d[myapp]: dispatchDetachedFromWindow
07-31 13:49:08.979 3631 3722 D InputEventReceiver: channel '4283642 Splash Screen com.mycompany.myapp (client)' ~ Disposing input event receiver.
07-31 13:49:08.979 3631 3722 D InputEventReceiver: channel '4283642 Splash Screen com.mycompany.myapp (client)' ~NativeInputEventReceiver.
07-31 13:49:08.979 3631 3655 V WindowManager: Relayout Window{d6f9efa u0 Application Error: com.mycompany.myapp}: 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}
07-31 13:49:08.986 3194 3194 D SurfaceFlinger: HWC | 708d63b000 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 7, 8, 1079, 1914 | com.mycompany.myapp/com.mycompany.myapp.MainActivity#0
07-31 13:49:08.986 3194 3194 D SurfaceFlinger: , 0.0, 1080.0, 1920.0 | 7, 8, 1079, 1914 | Splash Screen com.mycompany.myapp#0
07-31 13:49:08.987 3194 3194 I SurfaceFlinger: id=190 createSurf (13x13),1 flag=4, Application Error: com.mycompany.myapp#0
07-31 13:49:08.996 3631 3655 D ViewRootImpl@cedd1c[myapp]: Relayout returned: old=[0,0][0,0] new=[32,775][1047,1217] result=0x27 surface={valid=true 515659157504} changed=true
07-31 13:49:09.001 3194 3194 D SurfaceFlinger: HWC | 708d63b000 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 7, 8, 1079, 1914 | com.mycompany.myapp/com.mycompany.myapp.MainActivity#0
07-31 13:49:09.001 3194 3194 D SurfaceFlinger: HWC | 70a05848c0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 7, 8, 1079, 1914 | Splash Screen com.mycompany.myapp#0
07-31 13:49:09.001 3631 3655 D ViewRootImpl@cedd1c[myapp]: MSG_WINDOW_FOCUS_CHANGED 1
07-31 13:49:09.013 3631 3655 V WindowManager: finishDrawingLocked: mDrawState=COMMIT_DRAW_PENDING Window{d6f9efa u0 Application Error: com.mycompany.myapp} in Surface(name=Application Error: com.mycompany.myapp)
07-31 13:49:09.013 3631 3655 D ViewRootImpl@cedd1c[myapp]: MSG_RESIZED_REPORT: frame=Rect(32, 775 - 1047, 1217) ci=Rect(0, 0 - 0, 0) vi=Rect(0, 0 - 0, 0) or=1
07-31 13:49:09.019 3631 7968 V WindowManager: Relayout Window{28a4b9a u0 com.mycompany.myapp/com.mycompany.myapp.MainActivity}: viewVisibility=8 req=1080x1920 WM.LayoutParams{(0,0)(fillxfill) sim=#110 ty=1 fl=#81810100 pfl=0x20000 wanim=0x10302fd vsysui=0x600 needsMenuKey=2 colorMode=0 naviIconColor=0}
07-31 13:49:09.034 3631 7968 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mServices
07-31 13:49:09.034 3631 7968 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mProviders
07-31 13:49:09.034 3631 7968 D PackageManager: getComponentMetadataForIconTray : com.mycompany.myapp.MainActivity does not exist in mReceivers
07-31 13:49:09.034 4034 4591 D ApplicationPackageManager: updateItemMetaDataForFixedIconScale: package: com.mycompany.myapp
07-31 13:49:09.035 3631 7968 D PackageManager: getSelectedMetaData : packageName(com.mycompany.myapp) or Metadata strings {[Ljava.lang.String;@e7a6623}
07-31 13:49:09.035 4034 4591 I ApplicationPackageManager: load=com.mycompany.myapp, bg=144-144, dr=144-144, forDefault=true, density=0
07-31 13:49:09.037 4034 4591 I ApplicationPackageManager: load=com.mycompany.myapp-crop, bg=144-144, dr=144-144
07-31 13:49:09.068 3194 3194 D SurfaceFlinger: GLES | 708d63b000 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 298, 333, 1031, 1636 | com.mycompany.myapp/com.mycompany.myapp.MainActivity#0
07-31 13:49:09.068 3194 3194 D SurfaceFlinger: GLES | 70a05848c0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 298, 333, 1031, 1636 | Splash Screen com.mycompany.myapp#0
07-31 13:49:09.068 3194 3194 D SurfaceFlinger: 0.0, 1027.0, 454.0 | 66, 787, 1011, 1205 | Application Error: com.mycompany.myapp#0
07-31 13:49:09.085 3194 3194 D SurfaceFlinger: GLES | 708d63b000 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 346, 386, 1023, 1590 | com.mycompany.myapp/com.mycompany.myapp.MainActivity#0
07-31 13:49:09.085 3194 3194 D SurfaceFlinger: 0 | 0000 | 0020 | 00 | 0105 | RGBA_8888 | 0.0, 0.0, 1080.0, 1920.0 | 346, 38
我测试过的一些东西是:
我期待它构建一个发布模式,正确捆绑所有内容,并且当我打开它时不会使应用程序崩溃。
这件事有运气吗?我最近做了与将 sdk 级别升级到 34 相同的更改。现在我尝试将其发布到生产环境,谷歌对其进行了扫描,发现 SoLoader SDK 存在问题。