Reputation: 307
This problem specifically arises on Redmi Note 7 Pro and Note 9 Pro, I tested it on Pixel XL emulator and everything worked fine. But in my phone, this error occurs when I run the testConfiguration
, the app
configuration installs the app properly.
Installation did not succeed.
The application could not be installed.
List of apks:
[0] 'D:\andfun-kotlin-sleep-tracker-Step.03-Solution-Create-RoomDatabase\app\build\outputs\apk\debug\app-debug.apk'
Installation failed due to: ''cmd package install-create -r -t --user current --full --dont-kill -t -g -S 3932461' returns error 'Unknown failure: Security exception: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
java.lang.SecurityException: You need the android.permission.INSTALL_GRANT_RUNTIME_PERMISSIONS permission to use the PackageManager.INSTALL_GRANT_RUNTIME_PERMISSIONS flag
at com.android.server.pm.PackageInstallerService.createSessionInternal(PackageInstallerService.java:542)
at com.android.server.pm.PackageInstallerService.createSession(PackageInstallerService.java:465)
at com.android.server.pm.PackageManagerShellCommand.doCreateSession(PackageManagerShellCommand.java:2710)
at com.android.server.pm.PackageManagerShellCommand.runInstallCreate(PackageManagerShellCommand.java:1106)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:176)
at android.os.ShellCommand.exec(ShellCommand.java:111)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:22460)
at android.os.Binder.shellCommand(Binder.java:881)
at android.os.Binder.onTransact(Binder.java:765)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4882)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4113)
at android.os.Binder.execTransactInternal(Binder.java:1021)
at android.os.Binder.execTransact(Binder.java:994)''
I really can't understand why this error occurs only when running the test config.
I have spent 2 hours trying to figure this out, so any help would be greatly appreciated.
I don't think the test.kt code will be needed but if you need any other information please do tell me.
Upvotes: 0
Views: 708
Reputation: 39
This may not help, but atleast to share some experience on installation failures.
I use to encounter these types of errors when I'm running en emulator that doesn't reach my minimumSdk settings.
Upvotes: 0
Reputation: 158
I just searched online and found that Xiaomi devices have two developer options to be enabled for USB debugging they are
Developer options -> USB debugging Developer options -> USB debugging (Security Settings)
Ensure if you enabled both the options in your device.
For more information check out this question.
Upvotes: 1