Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to uninstall APK under Android 8 Oreo #9196

Closed
appiumnovice opened this issue Sep 12, 2017 · 19 comments · Fixed by appium/appium-adb#260
Closed

Unable to uninstall APK under Android 8 Oreo #9196

appiumnovice opened this issue Sep 12, 2017 · 19 comments · Fixed by appium/appium-adb#260
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing

Comments

@appiumnovice
Copy link

The problem

I have the error "Unable to uninstall APK ... 'Command '/Users/xxx/Library/android/sdk/platform-tools/adb -P 5037 -s 013a3a8de3d93345 uninstall com.xxx.fusion' exited with code 255'"
when I launch test on Android 8.0 (Oreo) on Emulator and on Device Nexus 5x.

Environment

  • Appium version (or git revision) that exhibits the issue: 1.6.5
  • Desktop OS/version used to run Appium: OSX 12.10.5
  • Mobile platform/version under test: Emulator from Android Studio 3 beta 5 with Android 8.0
  • Real device or emulator/simulator: Nexus 5x with Android 8.0
  • Appium CLI or Appium.app|exe: CLI

Details

On emulator, after the creation of the emulator, the app is installed once with success by Appium and the test is correctly run.
The reinstallation of the app for the next test doesn't work.
So I uninstalled the app manually and tried again : same error.

On device, I have the same error.

Link to Appium logs

Appium server log
https://gist.github.com/appiumnovice/c192975a6737ae8d18ac6b8a2f3f8371

@mykola-mokhnach
Copy link
Collaborator

Do you get the same error if this command is executed manually? What error description do you see in the terminal?
Also, make sure your platform tools are at the recent version.

@mykola-mokhnach mykola-mokhnach added the Android related to Android-native driver(s) label Sep 12, 2017
@appiumnovice
Copy link
Author

appiumnovice commented Sep 12, 2017

Yes, I have an error too :

adb -P 5037 -s 013a3a8de3d93345 uninstall com.sncf.fusion

Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: com.sncf.fusion
at com.android.server.pm.Settings.isOrphaned(Settings.java:4400)
at com.android.server.pm.PackageManagerService.isOrphaned(PackageManagerService.java:21418)
at com.android.server.pm.PackageManagerService.deletePackageVersioned(PackageManagerService.java:18492)
at com.android.server.pm.PackageInstallerService.uninstall(PackageInstallerService.java:913)
at com.android.server.pm.PackageManagerShellCommand.runUninstall(PackageManagerShellCommand.java:912)
at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:134)
at android.os.ShellCommand.exec(ShellCommand.java:96)
at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:21717)
at android.os.Binder.shellCommand(Binder.java:573)
at android.os.Binder.onTransact(Binder.java:473)
at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:2644)
at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:3485)
at android.os.Binder.execTransact(Binder.java:674)

I will check now the versions of my tools (I use the java client).

@mykola-mokhnach mykola-mokhnach added the Bug a problem that needs fixing label Sep 12, 2017
@mykola-mokhnach
Copy link
Collaborator

Yep, it looks like since 7.1 Android's pm tool handles missing package uninstall differently. Related issue reports:
https://jira.lineageos.org/browse/BUGBASH-999?attachmentViewMode=list
openstf/stf#448

@imurchie Looks like we need to handle this properly on our side as well

@mykola-mokhnach
Copy link
Collaborator

the fix is merged to 1.7.0-beta. Please update and let us know if it works

@appiumnovice
Copy link
Author

appiumnovice commented Sep 14, 2017

Thanks for your new release :)

I have many differents errors.

  1. The first time I run a test, I obtained the error "Unable to uninstall APK"

  2. After a new try, I obtained the error "Activity used to start app doesn't exist or cannot be launched!"

https://gist.github.com/appiumnovice/c192975a6737ae8d18ac6b8a2f3f8371#file-log-with-appium-1-7-0-beta

@imurchie
Copy link
Contributor

Can you delete the unlock helper? It seems to not be launchable for some reason?

@mykola-mokhnach
Copy link
Collaborator

Or set the skipUnlock capability to true

@appiumnovice
Copy link
Author

I tried the 2 solutions : remove Unlock before run the test and add the capability "skipUnlock".
Without success.

https://gist.github.com/appiumnovice/c192975a6737ae8d18ac6b8a2f3f8371#file-with-skipunlock

@mykola-mokhnach
Copy link
Collaborator

The recent log looks very messy to me. It looks like several operations are being concurrently executed at the same time and this causes problems.

@mykola-mokhnach mykola-mokhnach added Needs Info typically non-actionable; needs author to respond and removed Bug a problem that needs fixing labels Sep 15, 2017
@appiumnovice
Copy link
Author

appiumnovice commented Sep 15, 2017

OK. I stopped all others tests that run in parallel.

I tried 2 processes:

  1. The app is already installed (manually)
    -> The test run, despite the error "Activity used to start app doesn't exist or cannot be launched!" and "Unable to uninstall APK"
    https://gist.github.com/appiumnovice/c192975a6737ae8d18ac6b8a2f3f8371#file-app-still-installed

  2. The app is not installed and all Appiums tools are uninstalled
    -> The app is not installed
    https://gist.github.com/appiumnovice/c192975a6737ae8d18ac6b8a2f3f8371#file-app-is-not-installed

@mykola-mokhnach
Copy link
Collaborator

OK, found the problem.

@mykola-mokhnach mykola-mokhnach added Bug a problem that needs fixing and removed Needs Info typically non-actionable; needs author to respond labels Sep 15, 2017
@imurchie imurchie reopened this Sep 15, 2017
@imurchie
Copy link
Contributor

This should be fixed if you get the latest beta (npm uninstall -g appium && npm install -g appium@beta).

@appiumnovice
Copy link
Author

Yes, it works !
Thanks to you for your reactivity :)
You can close this issue.

@imurchie
Copy link
Contributor

All thanks go to @mykola-mokhnach !

@omidrezaaa
Copy link

@imurchie hi, could you help me how can i run your solution, i'm beginner and have same error:
npm uninstall -g appium && npm install -g appium@beta

@KazuCocoa
Copy link
Member

The command was uninstalling old appium and installing new one.
It meant to use newer appium.

@omidrezaaa
Copy link

@KazuCocoa now i want to know how can i run this command?
i use android studio 3.3

@KazuCocoa
Copy link
Member

Do you mean http://appium.io/docs/en/about-appium/intro/ 's Appium Server section?
@beta also can run with appium.
https://discuss.appium.io/ also helps you about such question.

@remmcal
Copy link

remmcal commented May 29, 2019

I did:
clean project
rebuild project
and I fixed that problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android related to Android-native driver(s) Bug a problem that needs fixing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants