shorebirdtech / shorebird

Code Push for Flutter and other tools for Flutter businesses.
https://shorebird.dev
Other
2.34k stars 141 forks source link

fix: `shorebird preview` fails with CLEAR_APP_USER_DATA permission error on some phones #1839

Open eseidel opened 7 months ago

eseidel commented 7 months ago
✓ Fetching releases (0.5s)
Which release would you like to preview?
Which release would you like to preview? 1.1.1.1+1111
✓ Using production track (1.8s)
✓ Extracting metadata (0.7s)
✓ Building apks (5.6s)
✓ Installing apks (33.3s)
✗ Exception: Unable to clear app data: Security exception: PID 7149 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.example.app

java.lang.SecurityException: PID 7149 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.example.app
        at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:4538)
        at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:1852)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:216)
        at android.os.ShellCommand.exec(ShellCommand.java:104)
        at com.android.server.pm.PackageManagerService.onShellCommand(PackageManagerService.java:24260)
        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:5118)
        at com.android.server.pm.PackageManagerService.onTransact(PackageManagerService.java:4883)
        at com.android.server.pm.OppoPackageManagerService.onTransact(OppoPackageManagerService.java:91)
        at android.os.Binder.execTransactInternal(Binder.java:1021)
        at android.os.Binder.execTransact(Binder.java:994)

Originally posted by @imeDevelopers in https://github.com/shorebirdtech/shorebird/issues/1696#issuecomment-1924956382

eseidel commented 7 months ago

I've seen one stack overflow say this is related to not having USB debugging enabled? https://stackoverflow.com/questions/24755341/unable-to-get-android-permission-clear-app-user-data

I've seen another say that this is related to certain OS phone vendors having buggy adbd (the daemon on the phone that handles the device's side of adb). https://github.com/appium/appium/issues/9807

eseidel commented 5 months ago

I don't think there is anything for us to do here atm, other than potentially improve the failure message?