Android应用程序崩溃错误未知管理员



我写了一个Kivy Python android应用程序,并使用buildozer创建了一个。apk文件。安装应用程序后,当试图打开它-它崩溃。在日志中,我看到如下内容:

2022-12-28 14:08:57.318 1816-2097/? E/EnterpriseDeviceManagerService: isMdmAdminPresentInternal() : failed. 
java.lang.IllegalArgumentException: Unknown admin: ComponentInfo{com.samsung.klmsagent/com.samsung.klmsagent.deviceAdminManager.AdminReceiver}
at com.android.server.enterprise.EnterpriseDeviceManagerServiceImpl.findAdmin(EnterpriseDeviceManagerServiceImpl.java:1593)
at com.android.server.enterprise.EnterpriseDeviceManagerServiceImpl.isMdmAdminPresentInternal(EnterpriseDeviceManagerServiceImpl.java:2722)
at com.android.server.enterprise.EnterpriseDeviceManagerServiceImpl.isMdmAdminPresent(EnterpriseDeviceManagerServiceImpl.java:2752)
at com.samsung.android.knox.EnterpriseDeviceManager.isMdmAdminPresent(EnterpriseDeviceManager.java:10)
at com.android.server.am.ActivityManagerService.updateActivityUsageStats(ActivityManagerService.java:3369)
at com.android.server.am.ActivityManagerService$LocalService.updateActivityUsageStatsWithIntent(ActivityManagerService.java:19576)
at com.android.server.wm.ActivityTaskManagerService$$ExternalSyntheticLambda22.accept(Unknown Source:27)
at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:363)
at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:204)
at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:226)
at android.os.Looper.loop(Looper.java:313)
at android.os.HandlerThread.run(HandlerThread.java:67)
at com.android.server.ServiceThread.run(ServiceThread.java:44)

我已经读过了,并理解需要使用adb更改所有者:./adb shell dpm set-device-owner com.samsung.klmsagent/.deviceAdminManager.AdminReceiver

我已经试过了,但是得到以下错误:

Exception occurred while executing 'set-device-owner':
java.lang.IllegalArgumentException: Unknown admin: ComponentInfo{com.samsung.klmsagent/com.samsung.klmsagent.deviceAdminManager.AdminReceiver}
at com.android.server.devicepolicy.DevicePolicyManagerService.findAdmin(DevicePolicyManagerService.java:3152)
at com.android.server.devicepolicy.DevicePolicyManagerService.setActiveAdmin(DevicePolicyManagerService.java:3726)
at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.runSetDeviceOwner(DevicePolicyManagerServiceShellCommand.java:256)
at com.android.server.devicepolicy.DevicePolicyManagerServiceShellCommand.onCommand(DevicePolicyManagerServiceShellCommand.java:89)
at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
at android.os.ShellCommand.exec(ShellCommand.java:38)
at com.android.server.devicepolicy.DevicePolicyManagerService.onShellCommand(DevicePolicyManagerService.java:10669)
at android.os.Binder.shellCommand(Binder.java:1085)
at android.os.Binder.onTransact(Binder.java:903)
at android.app.admin.IDevicePolicyManager$Stub.onTransact(IDevicePolicyManager.java:6790)
at android.os.Binder.execTransactInternal(Binder.java:1321)
at android.os.Binder.execTransact(Binder.java:1280)

buildozer spec file:

[app]
# (str) Title of your application
title = Dikduk
# (str) Package name
package.name = dikduk
# (str) Package domain (needed for android/ios packaging)
package.domain = org.dikduk
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas
# (str) Application versioning (method 1)
version = 0.1
# (list) Application requirements
# comma separated e.g. requirements = sqlite3,kivy
requirements = python3,kivy==master,pillow
# (str) Supported orientation (one of landscape, sensorLandscape, portrait or all)
orientation = portrait
# change the major version of python used by the app
osx.python_version = 3
# Kivy version to use
osx.kivy_version = 1.9.1
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 0
# (str) The format used to package the app for release mode (aab or apk or aar).
android.release_artifact = aab
#
# iOS specific
#
ios.kivy_ios_url = https://github.com/kivy/kivy-ios
ios.kivy_ios_branch = master
ios.ios_deploy_url = https://github.com/phonegap/ios-deploy
ios.ios_deploy_branch = 1.10.0
# (bool) Whether or not to sign the code
ios.codesign.allowed = false
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1

有人能帮我一下吗?谢谢:)

我通过使用Android Studio的logcat在Verbose lop级别发现了这个问题:在开发者模式下更改手机工作。将手机连接到电脑上,然后查看导致问题的原因

最新更新