"App isn't installed" 与 Android SDK 31

"App isn't installed" with Android SDK 31

这是一个热门话题!

针对 Android SDK 31,当我尝试 运行 我签名的发布 APK 构建时,显示“应用程序未安装”消息。但是,我可以从 应用程序信息 屏幕打开 应用程序。这是为什么,这通常是什么指标?

Logcat 似乎分享了一些有用的东西...权限相关 (SecurityException) ?

2022-02-20 20:52:58.762 5327-5327/? E/BaseDraggingActivity: Unable to launch. tag=WorkspaceItemInfo(id=-1 type=APP container=# com.android.launcher3.logger.LauncherAtom$ContainerInfo@1a64a84
    predicted_hotseat_container {
      index: 2
    } targetComponent=ComponentInfo{com.luma.android/com.luma.android.activities.SplashActivity} screen=2 cell(2,0) span(1,1) minSpan(1,1) rank=2 user=UserHandle{0} title=Luma) intent=Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.luma.android/.activities.SplashActivity bnds=[440,1821][641,1989] }
    java.lang.SecurityException: Permission Denial: starting Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=com.luma.android/.activities.SplashActivity bnds=[440,1821][641,1989] } from ProcessRecord{c90dcf 5327:com.google.android.apps.nexuslauncher/u0a240} (pid=5327, uid=10240) not exported from uid 10507
        at android.os.Parcel.createExceptionOrNull(Parcel.java:2425)
        at android.os.Parcel.createException(Parcel.java:2409)
        at android.os.Parcel.readException(Parcel.java:2392)
        at android.os.Parcel.readException(Parcel.java:2334)
        at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:2284)
        at android.app.Instrumentation.execStartActivity(Instrumentation.java:1743)
        at android.app.Activity.startActivityForResult(Activity.java:5403)
        at com.android.launcher3.Launcher.startActivityForResult(SourceFile:2)
        at com.android.launcher3.BaseQuickstepLauncher.startActivityForResult(SourceFile:6)
        at android.app.Activity.startActivity(Activity.java:5743)
        at com.android.launcher3.BaseDraggingActivity.startActivitySafely(SourceFile:14)
        at com.android.launcher3.Launcher.startActivitySafely(SourceFile:6)
        at com.android.launcher3.uioverrides.QuickstepLauncher.startActivitySafely(SourceFile:2)
        at com.android.launcher3.touch.ItemClickHandler.startAppShortcutOrInfoActivity(SourceFile:14)
        at com.android.launcher3.touch.ItemClickHandler.onClickAppShortcut(SourceFile:8)
        at com.android.launcher3.touch.ItemClickHandler.onClick(SourceFile:6)
        at com.android.launcher3.touch.ItemClickHandler.b(Unknown Source:0)
        at S0.f.onClick(Unknown Source:0)
        at android.view.View.performClick(View.java:7441)
        at android.view.View.performClickInternal(View.java:7418)
        at android.view.View.access00(View.java:835)
        at android.view.View$PerformClick.run(View.java:28677)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loopOnce(Looper.java:201)
        at android.os.Looper.loop(Looper.java:288)
        at android.app.ActivityThread.main(ActivityThread.java:7839)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1003)
     Caused by: android.os.RemoteException: Remote stack trace:
        at com.android.server.wm.ActivityTaskSupervisor.checkStartAnyActivityPermission(ActivityTaskSupervisor.java:1047)
        at com.android.server.wm.ActivityStarter.executeRequest(ActivityStarter.java:975)
        at com.android.server.wm.ActivityStarter.execute(ActivityStarter.java:665)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1201)
        at com.android.server.wm.ActivityTaskManagerService.startActivityAsUser(ActivityTaskManagerService.java:1173)
2022-02-20 20:53:14.896 6140-12966/? E/BluetoothUtils: Permission denial: Need ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATIONpermission to get scan results
2022-02-20 20:53:15.251 16129-19193/? E/TcpProberDeviceController: [TcpProberDeviceController-1] TcpProberDeviceController 1 timed out.
2022-02-20 20:53:17.256 16129-8524/? E/CastSocket: [TcpProberDeviceController-1] Failed to shutdown the output stream socket: rux@8267495.
    java.net.SocketException: Socket is not connected
        at sun.nio.ch.Net.translateToSocketException(Net.java:129)
        at sun.nio.ch.Net.translateException(Net.java:166)
        at sun.nio.ch.Net.translateException(Net.java:172)
        at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:426)
        at rtx.l(:com.google.android.gms@214815044@21.48.15 (190400-414534850):4)
        at ruc.c(:com.google.android.gms@214815044@21.48.15 (190400-414534850):19)
        at rub.run(:com.google.android.gms@214815044@21.48.15 (190400-414534850):2)
        at java.lang.Thread.run(Thread.java:920)
     Caused by: java.nio.channels.NotYetConnectedException
        at sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:844)
        at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:424)
        at rtx.l(:com.google.android.gms@214815044@21.48.15 (190400-414534850):4) 
        at ruc.c(:com.google.android.gms@214815044@21.48.15 (190400-414534850):19) 
        at rub.run(:com.google.android.gms@214815044@21.48.15 (190400-414534850):2) 
        at java.lang.Thread.run(Thread.java:920) 

预先感谢您的协助。

只需将此代码添加到您的 AndroidManifest.xml

<activity
        ....
        android:exported="false" />