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

fix: When running shorebird preview , getting unable to clear app data error #2426

Open
nateshmbhat opened this issue Aug 17, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@nateshmbhat
Copy link

nateshmbhat commented Aug 17, 2024

App ID: 007a2cb9-86ee-4f73-90db-1d3322af1863

Description
Getting below error when running shorebird preview :

➜  flutter_codepush_poc git:(main) ✗ shorebird preview
✓ Fetching releases (0.7s)
✓ Fetching releases (0.7s)
Which release would you like to preview? 1.0.2+1
✓ Fetching aab artifact (0.5s)
✓ Downloading release (20.3s)
✓ Using production track (0.3s)
✓ Extracting metadata (0.6s)
✓ Building apks (3.6s)
✓ Installing apks (5.2s)
✗ Exception: Unable to clear app data: 
Exception occurred while executing 'clear':
java.lang.SecurityException: PID 7456 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.example.flutter_codepush_poc
        at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:4021)
        at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:2473)
        at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:277)
        at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
        at android.os.ShellCommand.exec(ShellCommand.java:38)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6823)
        at android.os.Binder.shellCommand(Binder.java:1081)
        at android.os.Binder.onTransact(Binder.java:901)
        at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4352)
        at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6807)
        at android.os.Binder.execTransactInternal(Binder.java:1362)
        at android.os.Binder.execTransact(Binder.java:1288)
 (98ms)

If you aren't sure why this command failed, re-run with the --verbose flag to see more information.

You can also file an issue if you think this is a bug. Please include the following log file in your report:
/Users/natesh.bhat/Library/Application Support/shorebird/logs/1723891294086_shorebird.log

Additional Context

2024-08-17T16:11:34.208927 [HTTP] GET https://api.shorebird.dev/api/v1/apps/007a2cb9-86ee-4f73-90db-1d3322af1863/releases
2024-08-17T16:11:34.216894 [HTTP] GET https://api.shorebird.dev/api/v1/apps/007a2cb9-86ee-4f73-90db-1d3322af1863/releases?sideloadable=true
2024-08-17T16:11:34.285777 
⠙ Fetching releases... (83ms)

...2024-08-17T16:11:34.928431 
✓ Fetching releases (0.7s)

2024-08-17T16:11:34.930840 
✓ Fetching releases (0.7s)

2024-08-17T16:11:34.933196 �7
2024-08-17T16:11:37.499349 Which release would you like to preview?
2024-08-17T16:11:37.499445 ❯
2024-08-17T16:11:37.499541  ◉  1.0.2+1
2024-08-17T16:11:37.499607 

2024-08-17T16:11:37.499731  
2024-08-17T16:11:37.499796  ◯  1.0.1+1
2024-08-17T16:11:37.499849 

2024-08-17T16:11:37.499897  
2024-08-17T16:11:37.499945  ◯  1.0.0+1
2024-08-17T16:11:37.826149 �8
2024-08-17T16:11:37.826443 
2024-08-17T16:11:37.826549 
2024-08-17T16:11:37.826624 Which release would you like to preview? 
2024-08-17T16:11:37.826849 1.0.2+1
2024-08-17T16:11:37.849823 [HTTP] GET https://api.shorebird.dev/api/v1/apps/007a2cb9-86ee-4f73-90db-1d3322af1863/releases/86043/artifacts?arch=aab&platform=android
2024-08-17T16:11:37.926457 
⠙ Downloading release... (81ms)
2024-08-17T16:11:37.926649 
⠙ Fetching aab artifact... (81ms)
2024-08-17T16:11:38.007882 
⠹ Downloading release... (0.2s)
2024-08-17T16:11:38.008109 
⠹ Fetching aab artifact... (0.2s)
2024-08-17T16:11:38.087606 
⠸ Downloading release... (0.2s)
2024-08-17T16:11:38.088207 
⠸ Fetching aab artifact... (0.2s)
2024-08-17T16:11:38.167358 
⠼ Downloading release... (0.3s)
2024-08-17T16:11:38.167888 
⠼ Fetching aab artifact... (0.3s)
2024-08-17T16:11:38.248941 
⠴ Downloading release... (0.4s)
2024-08-17T16:11:38.249158 
⠴ Fetching aab artifact... (0.4s)
2024-08-17T16:11:38.328404 
⠦ Downloading release... (0.5s)
2024-08-17T16:11:38.334209 
⠦ Fetching aab artifact... (0.5s)
2024-08-17T16:11:38.371410 
✓ Fetching aab artifact (0.5s)

2024-08-17T16:11:38.384484 [HTTP] GET https://storage.googleapis.com/shorebird_release_artifacts/007a2cb9-86ee-4f73-90db-1d3322af1863%2Fandroid%2Faab%2F86043%2Fapp-release.aab?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=patch-artifacts-storage-bucket%40code-push-prod.iam.gserviceaccount.com%2F20240817%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20240817T104138Z&X-Goog-Expires=3600&X-Goog-SignedHeaders=host&X-Goog-Signature=78bc07aac206740652f78e30cb593f0ca1891992c5b8c2af5b1898fe1d1ecb0fa5098385485a7d3cfc02826279344fd17f0e17e1877b52758005c90e40656a740692c60241bc2d91981d7a5f2bf4667d3b5ff6245487cdb6549eff14ba22177d414b72ca94c27e39cc4d2ac3898d299192cfb03d03eee7e464d3b48fb9f8e91c1fbd53243dbaf2726bbdc202c0ce41adccdab108887ef93555185cb8f2ca4f227a33917dbe304416d1e897e9c3d59b1abc2950677f8424a235181a79547d91e4c24811d740a96f166bce7e7ac8d26a99e249d70875d3290c1274fbb6b19dbd0abd408513420b6ffcd2df02b4fffedf5287e865b014875611322e894703f7fece
2024-08-17T16:11:38.407761 
...
2024-08-17T16:11:58.151437 
✓ Downloading release (20.3s)

2024-08-17T16:11:58.233413 
⠙ Using production track... (81ms)
2024-08-17T16:11:58.313800 
⠹ Using production track... (0.2s)
2024-08-17T16:11:58.393735 
⠸ Using production track... (0.2s)
2024-08-17T16:11:58.460040 
✓ Using production track (0.3s)

2024-08-17T16:11:58.461361 No checksum provided for patch, skipping file corruption validation
2024-08-17T16:11:58.804949 No checksum provided for aot-tools.dill, skipping file corruption validation
2024-08-17T16:11:58.806745 [Process.run] /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java -jar /Users/natesh.bhat/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar dump manifest --bundle=/Users/natesh.bhat/.shorebird/bin/cache/previews/007a2cb9-86ee-4f73-90db-1d3322af1863/android_1.0.2+1_335081.aab --xpath /manifest/@package
2024-08-17T16:11:58.807009 
⠙ Extracting metadata... (0.3s)
2024-08-17T16:11:58.861844 
⠹ Extracting metadata... (0.4s)
2024-08-17T16:11:58.942496 
⠸ Extracting metadata... (0.5s)
2024-08-17T16:11:59.021922 
⠼ Extracting metadata... (0.6s)
2024-08-17T16:11:59.042549 Exited with code 0
2024-08-17T16:11:59.042778 
stdout:
com.example.flutter_codepush_poc

2024-08-17T16:11:59.042919 
✓ Extracting metadata (0.6s)

2024-08-17T16:11:59.043420 No checksum provided for patch, skipping file corruption validation
2024-08-17T16:11:59.343045 No checksum provided for aot-tools.dill, skipping file corruption validation
2024-08-17T16:11:59.343566 [Process.run] /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java -jar /Users/natesh.bhat/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar build-apks --overwrite --bundle=/Users/natesh.bhat/.shorebird/bin/cache/previews/007a2cb9-86ee-4f73-90db-1d3322af1863/android_1.0.2+1_335081.aab --output=/Users/natesh.bhat/.shorebird/bin/cache/previews/007a2cb9-86ee-4f73-90db-1d3322af1863/android_1.0.2+1_335081.apks --mode=universal
2024-08-17T16:11:59.343920 
⠙ Building apks... (0.3s)
....2024-08-17T16:12:02.564634 
⠹ Building apks... (3.5s)
2024-08-17T16:12:02.623562 Exited with code 0
2024-08-17T16:12:02.623755 
stdout:
INFO: The APKs will be signed with the debug keystore found at '/Users/natesh.bhat/.android/debug.keystore'.

2024-08-17T16:12:02.623884 
✓ Building apks (3.6s)

2024-08-17T16:12:02.624478 No checksum provided for patch, skipping file corruption validation
2024-08-17T16:12:02.924061 No checksum provided for aot-tools.dill, skipping file corruption validation
2024-08-17T16:12:02.924645 [Process.run] /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java -jar /Users/natesh.bhat/.shorebird/bin/cache/artifacts/bundletool/bundletool.jar install-apks --apks=/Users/natesh.bhat/.shorebird/bin/cache/previews/007a2cb9-86ee-4f73-90db-1d3322af1863/android_1.0.2+1_335081.apks --allow-downgrade
2024-08-17T16:12:02.924899 
⠙ Installing apks... (0.3s)
...2024-08-17T16:12:07.826222 
⠸ Installing apks... (5.2s)
2024-08-17T16:12:07.862243 Exited with code 0
2024-08-17T16:12:07.862402 
stderr:
The APKs have been extracted in the directory: /var/folders/p8/95_nk7451mv5z1_lp77q85krs14n_p/T/371881211909784697

2024-08-17T16:12:07.862535 
✓ Installing apks (5.2s)

2024-08-17T16:12:07.863663 [Process.run] /Users/natesh.bhat/Library/Android/sdk/platform-tools/adb shell pm clear com.example.flutter_codepush_poc
2024-08-17T16:12:07.945493 
⠙ Starting app... (82ms)
2024-08-17T16:12:07.959951 Exited with code 255
2024-08-17T16:12:07.960121 
stderr:

Exception occurred while executing 'clear':
java.lang.SecurityException: PID 7456 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.example.flutter_codepush_poc
	at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:4021)
	at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:2473)
	at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:277)
	at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
	at android.os.ShellCommand.exec(ShellCommand.java:38)
	at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6823)
	at android.os.Binder.shellCommand(Binder.java:1081)
	at android.os.Binder.onTransact(Binder.java:901)
	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4352)
	at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6807)
	at android.os.Binder.execTransactInternal(Binder.java:1362)
	at android.os.Binder.execTransact(Binder.java:1288)

2024-08-17T16:12:07.961293 
✗ Exception: Unable to clear app data: 
Exception occurred while executing 'clear':
java.lang.SecurityException: PID 7456 does not have permission android.permission.CLEAR_APP_USER_DATA to clear data of package com.example.flutter_codepush_poc
	at com.android.server.am.ActivityManagerService.clearApplicationUserData(ActivityManagerService.java:4021)
	at com.android.server.pm.PackageManagerShellCommand.runClear(PackageManagerShellCommand.java:2473)
	at com.android.server.pm.PackageManagerShellCommand.onCommand(PackageManagerShellCommand.java:277)
	at com.android.modules.utils.BasicShellCommandHandler.exec(BasicShellCommandHandler.java:97)
	at android.os.ShellCommand.exec(ShellCommand.java:38)
	at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onShellCommand(PackageManagerService.java:6823)
	at android.os.Binder.shellCommand(Binder.java:1081)
	at android.os.Binder.onTransact(Binder.java:901)
	at android.content.pm.IPackageManager$Stub.onTransact(IPackageManager.java:4352)
	at com.android.server.pm.PackageManagerService$IPackageManagerImpl.onTransact(PackageManagerService.java:6807)
	at android.os.Binder.execTransactInternal(Binder.java:1362)
	at android.os.Binder.execTransact(Binder.java:1288)
 (98ms)

2024-08-17T16:12:07.961546 
If you aren't sure why this command failed, re-run with the --verbose flag to see more information.

You can also [file an issue](https://github.com/shorebirdtech/shorebird/issues/new/choose) if you think this is a bug. Please include the following log file in your report:
/Users/natesh.bhat/Library/Application Support/shorebird/logs/1723891294086_shorebird.log

2024-08-17T16:12:07.961809 [Process.run] git symbolic-ref HEAD (in /Users/natesh.bhat/.shorebird/bin/cache)
2024-08-17T16:12:07.983118 Exited with code 0
2024-08-17T16:12:07.983329 
stdout:
refs/heads/stable

2024-08-17T16:12:07.983482 [Process.run] git rev-parse --verify HEAD (in /Users/natesh.bhat/.shorebird/bin/cache)
2024-08-17T16:12:07.995104 Exited with code 0
2024-08-17T16:12:07.995326 
stdout:
22e6a779fc30b4e0f5e9b8987938569d145fa626

2024-08-17T16:12:07.995454 [Process.run] git remote prune origin (in /Users/natesh.bhat/.shorebird/bin/cache)
2024-08-17T16:12:09.353733 Exited with code 0
2024-08-17T16:12:09.354042 [Process.run] git fetch --tags (in /Users/natesh.bhat/.shorebird/bin/cache)
2024-08-17T16:12:10.411721 Exited with code 0
2024-08-17T16:12:10.411958 [Process.run] git rev-parse --verify @{upstream} (in /Users/natesh.bhat/.shorebird/bin/cache)
2024-08-17T16:12:10.423736 Exited with code 0
2024-08-17T16:12:10.423927 
stdout:
22e6a779fc30b4e0f5e9b8987938569d145fa626

@nateshmbhat nateshmbhat added the bug Something isn't working label Aug 17, 2024
@nateshmbhat
Copy link
Author

nateshmbhat commented Aug 17, 2024

Though my usb debugging was enabled it happened.

I fixed it by changing the usb connection mode from charging to "Transfering files" and Enabling this "Disable Permission Monitoring" option in phone settings.

@eseidel
Copy link
Contributor

eseidel commented Aug 19, 2024

We could still catch this error and display something better.

@eseidel eseidel reopened this Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants