Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging Android apps via IntelliJ/Android SDK on my Samsung Galaxy S10+ results in "Error while Installing APKs"

I decided to generate even more money and develop my first app for Android. When I want to deploy my app (just the skeleton code from IntelliJ/Android SDK) with one MainActivity I am getting the following error.

enter image description here

The log of the run looks like this.

5/07 21:32:35: Launching app

$ adb install-multiple -r -t

C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_7.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_6.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_8.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_9.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_4.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_5.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_3.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\resources\instant-run\debug\resources-debug.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_0.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_1.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\dep\dependencies.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\split-apk\debug\slices\slice_2.apk C:\Users\Tony\Code\Java\PureWallpaper\app\build\intermediates\instant-run-apk\debug\app-debug.apk

$ adb shell pm uninstall com.stark.purewallpaper

Unknown failure: Exception occurred while executing: java.lang.IllegalArgumentException: Unknown package: com.stark.purewallpaper at com.android.server.pm.Settings.getInstallerPackageNameLPr(Settings.java:4671) at com.android.server.pm.PackageManagerService.getInstallerPackageName(PackageManagerService.java:25342) at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:25348) at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:21062) at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:924) at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:1486) at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:193) at android.os.ShellCommand.exec(ShellCommand.java:103) at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:25884) at android.os.Binder.shellCommand(Binder.java:642) at android.os.Binder.onTransact(Binder.java:540) at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:3329) at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4763) at android.os.Binder.execTransact(Binder.java:739) Error while Installing APKs

The event log looks like this.

21:32 Executing tasks: [:app:assembleDebug] 21:32 Gradle build finished in 493 ms 21:32 Failed to finalize session : -118

Things I tried on the phone:

  • re-enabled dev mode
  • re-enabled USB debugging
  • tried different default usb configurations like "picture" or "file" transfer
  • tried activating "wait for debugger" option

Things I tried in IntelliJ:

  • deactivated "Instant Run"
  • installed all SDK tools, including the "Google USB Driver"
  • cleaned and rebuild the project

IntelliJ can clearly see my device, it even detects the type correctly.

enter image description here

I am on:

  • Windows 10
  • IntelliJ 2019.1.1
  • Newest Android SDK that comes with IntelliJ

I decided to try this on Android Studio 3.4 and I'm getting same error.

enter image description here

I am able to run the app inside the emulator/virtual device but not on my Samsung Galaxy S10+. Any ideas?

like image 412
Tony Stark Avatar asked Dec 06 '22 09:12

Tony Stark


1 Answers

If none of the solution mentioned above works, you can turn off the instant run option as shown in the image from setting

like image 73
Shakil Ahmed Shaj Avatar answered Dec 11 '22 10:12

Shakil Ahmed Shaj