生成APK(签名)升级gradle版本时出现问题



我正在尝试将我的gradle版本更新到最新版本,一切正常,但当我生成签名的APK时,应用程序停止工作(不启动(。目前我有:安卓gradle插件版本:4.1.2Gradle版本:6.5

我已尝试更新到:安卓gradle插件版本:4.2.0渐变版本:7.0.2这就是我的问题所在,我生成了签名的APK,应用程序不起作用。

我怀疑这是否与Proguard或R8有关,我不太了解这些文件,所以我试着不运行它们,看看它是否来自于失败,但即使如此,我还是让它发挥了作用。

me构建类型:

buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles 'proguard-android.txt'
}
}

你知道问题出在哪里吗?

logcat:

12-24 11:23:10.982   504  1885 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.spotbros.defense/com.spotbros.spotbroslib.MainActivity bnds=[842,613][1043,923]} from uid 10129
12-24 11:23:10.984   504  1885 W ActivityTaskManager: Can't find TaskDisplayArea to determine support for multi window. Task id=39 attached=false
12-24 11:23:10.986   970  1660 D EGL_emulation: app_time_stats: avg=2043.51ms min=16.19ms max=14202.23ms count=7
12-24 11:23:10.990   504  1885 D CompatibilityChangeReporter: Compat change id reported: 174042980; UID 10147; state: DISABLED
12-24 11:23:10.992   504  1885 D CompatibilityChangeReporter: Compat change id reported: 184838306; UID 10147; state: DISABLED
12-24 11:23:10.994   504  1885 D CompatibilityChangeReporter: Compat change id reported: 185004937; UID 10147; state: DISABLED
12-24 11:23:10.997   504  1885 D CompatibilityChangeReporter: Compat change id reported: 181136395; UID 10147; state: DISABLED
12-24 11:23:10.998   504  1885 D CompatibilityChangeReporter: Compat change id reported: 174042936; UID 10147; state: DISABLED
12-24 11:23:11.002   504  1885 D CompatibilityChangeReporter: Compat change id reported: 168419799; UID 10147; state: DISABLED
12-24 11:23:11.017   504   541 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10147; state: DISABLED
12-24 11:23:11.017   504   550 D CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10147; state: ENABLED
12-24 11:23:11.029   320   320 D Zygote  : Forked child process 23520
12-24 11:23:11.032   504   550 I ActivityManager: Start proc 23520:com.spotbros.defense/u0a147 for pre-top-activity {com.spotbros.defense/com.spotbros.spotbroslib.MainActivity}
12-24 11:23:11.041 23520 23520 W potbros.defens: Unexpected CPU variant for X86 using defaults: x86_64
12-24 11:23:11.047 23520 23520 E potbros.defens: Not starting debugger since process cannot load the jdwp agent.
12-24 11:23:11.057   353   353 D goldfish-address-space: claimShared: Ask to claim region [0x3f0f68000 0x3f18cd000]
12-24 11:23:11.073   353   353 D goldfish-address-space: claimShared: Ask to claim region [0x3f71ef000 0x3f7b54000]
12-24 11:23:11.073   504   532 W InputReader: Device virtio_input_multi_touch_5 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_10 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_11 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_4 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_7 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_6 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_9 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_3 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_5 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_10 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_11 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_4 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_7 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_6 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_9 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.074   504   532 W InputReader: Device virtio_input_multi_touch_3 is associated with display ADISPLAY_ID_NONE.
12-24 11:23:11.090 23520 23520 D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10147; state: DISABLED
12-24 11:23:11.104   353   353 D goldfish-address-space: claimShared: Ask to claim region [0x3f4feb000 0x3f5950000]
12-24 11:23:11.120   504   659 D CompatibilityChangeReporter: Compat change id reported: 171306433; UID 10147; state: DISABLED
12-24 11:23:11.146 23520 23520 V GraphicsEnvironment: ANGLE Developer option for 'com.spotbros.defense' set to: 'default'
12-24 11:23:11.150 23520 23520 V GraphicsEnvironment: Neither updatable production driver nor prerelease driver is supported.
12-24 11:23:11.155 23520 23520 D NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: false
12-24 11:23:11.160  2116  2116 I GsaVoiceInteractionSrv: Handling ACTION_STOP_HOTWORD
12-24 11:23:11.162  2116  2116 E HwDetectorWithState: a: 3
12-24 11:23:11.170 23520 23520 D NetworkSecurityConfig: Using Network Security Config from resource network_security_config debugBuild: false
12-24 11:23:11.174 23520 23520 I MultiDex: VM with version 2.1.0 has multidex support
12-24 11:23:11.176 23520 23520 I MultiDex: Installing application
12-24 11:23:11.178 23520 23520 I MultiDex: VM has multidex support, MultiDex support library is disabled.
12-24 11:23:11.194   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.197   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.209 23520 23520 D FirebaseApp: com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization.
12-24 11:23:11.211   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.213   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.217 23520 23520 D FirebaseApp: com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization.
12-24 11:23:11.219 23520 23520 D FirebaseApp: com.google.android.gms.measurement.AppMeasurement is not linked. Skipping initialization.
12-24 11:23:11.221 23520 23520 I FirebaseInitProvider: FirebaseApp initialization successful
12-24 11:23:11.228   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.239   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.245   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.255 23520 23520 W System.err: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
12-24 11:23:11.255 23520 23520 W System.err: SLF4J: Defaulting to no-operation (NOP) logger implementation
12-24 11:23:11.255 23520 23520 W System.err: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
12-24 11:23:11.257   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.261   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.263   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.279   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.281   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.294   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.297   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.311   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.313   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.320 23520 23520 D ActivityThread: Loading provider com.spotbros.defense.contentproviders.multiprocesspreferencesprovider: com.imbox.defense.database.ImboxDefenseMultiprocessPreferencesProvider
12-24 11:23:11.327   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.330   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.344   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.347   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.361   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.363   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.377   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.379   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.395   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.397   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.411   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.413   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.428   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.430   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.445   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.447   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.462   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.464   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.478   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.480   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.494   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.497   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.511   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.514   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.528   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.532   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.545   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.548   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.561   355   355 W RanchuHwc: validateDisplay: layer 706 CompositionType 1, fallback
12-24 11:23:11.564   355   355 W RanchuHwc: presentDisplay display has no layers to compose, flushing client target buffer.
12-24 11:23:11.620   504  1885 W ActivityManager: Unable to start service Intent { act=android.service.smartspace.SmartspaceService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiSmartspaceService } U=0: not found
12-24 11:23:11.620   504  1885 W RemoteSmartspaceService: could not bind to Intent { act=android.service.smartspace.SmartspaceService cmp=com.google.android.as/com.google.android.apps.miphone.aiai.app.AiAiSmartspaceService } using flags 67112961
12-24 11:23:11.622   504   504 W ActivityManager: Unbind failed: could not find connection for android.app.LoadedApk$ServiceDispatcher$InnerConnection@4d069a6
12-24 11:23:11.625   727   779 D EGL_emulation: app_time_stats: avg=1663.02ms min=13.67ms max=14835.26ms count=9
12-24 11:23:11.946 23520 23520 E ActivityThread: Failed to find provider info for com.spotbros.enterprise.contentproviders.mainprovider
12-24 11:23:11.949 23520 23520 E ActivityThread: Failed to find provider info for com.spotbros.enterprise.contentproviders.mainprovider
12-24 11:23:11.952 23520 23520 E ActivityThread: Failed to find provider info for com.spotbros.enterprise.contentproviders.mainprovider
12-24 11:23:11.955   504  1885 D CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10147; state: DISABLED
12-24 11:23:11.957   504   550 D CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10147; state: ENABLED
12-24 11:23:11.965   320   320 D Zygote  : Forked child process 23543
12-24 11:23:11.966   504   550 I ActivityManager: Start proc 23543:com.spotbros.defense:remote/u0a147 for service {com.spotbros.defense/com.spotbros.service.SpotBrosService}
12-24 11:23:11.970 23520 23520 E ActivityThread: Failed to find provider info for com.spotbros.enterprise.contentproviders.mainprovider
12-24 11:23:11.972 23520 23520 E ActivityThread: Failed to find provider info for com.spotbros.enterprise.contentproviders.mainprovider
12-24 11:23:11.974 23520 23520 D AndroidRuntime: Shutting down VM
12-24 11:23:11.978 23520 23520 E AndroidRuntime: FATAL EXCEPTION: main
12-24 11:23:11.978 23520 23520 E AndroidRuntime: Process: com.spotbros.defense, PID: 23520
12-24 11:23:11.978 23520 23520 E AndroidRuntime: java.lang.RuntimeException: Unable to create application com.spotbros.application.SpotbrosApplication: java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference

您必须为'minimyEnabled'和'shrinkResources'设置false才能发布

buildTypes {
release {
minifyEnabled false
shrinkResources false
proguardFiles 'proguard-android.txt'
}
}

如果你在应用程序中使用数据库,可能是因为你在proguard文件中对数据库的设置,你应该在签署apk时检查数据库文件的存在。

最新更新