I cannot run app on Android 8.0 Oreo

I cannot run app on Android 8.0 Oreo
0.0 0

#1

When I tried to run app on Android device, I got an error.
I’m using cocos2d-x 3.15.1, android-ndk-r14b, and Android 8.0 Oreo.

cocos run -p android --android-studio -m release

Move apk to /Users/masanori/testA/bin/release/android
Build succeed.
Deploying mode: release
Installing on device
running: '/Users/masanori/Library/Android/sdk/platform-tools/adb uninstall info.mygames888.testA'


Exception occurred while executing:
java.lang.IllegalArgumentException: Unknown package: info.mygames888.testA
	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)
Error running command, return code: 255.

How can I solve this error?
Thank you.


#2

cocos run -p android --android-studio -m release --no-uninstall

I could avoid the problem by executing the command with --no-uninstall option.


#3

Good to know, it seems there is something wrong when uninstalling apk. I have not idea what’s the reason.


#4

Android Nougat and above try doing this:

adb -s device_id shell pm install -r -t your_path