[TIMOB-28005] Android: Unable to reinstall on apk using adb on Android 23
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2020-07-08T18:33:15.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 9.0.3 |
Components | Android |
Labels | n/a |
Reporter | Samir Mohammed |
Assignee | Gary Mathews |
Created | 2020-07-07T17:36:05.000+0000 |
Updated | 2020-07-08T21:49:13.000+0000 |
Description
When reinstalling an APK on an android 23 emulator using adb the following error can be seen Find the generated .apk e.g.
Run
Failure [INSTALL_FAILED_ALREADY_EXISTS]
but if you use an android 29 emulator, the issue can not be seen.
*Test Steps:*
Build a titanium application
Find the generated .apk e.g. build/android/app/build/outputs/apk/debug/app-debug.apk
Open an android 23 emulator
Run adb install %Path_to_apk_goes_here%
e.g. adb install /Users/samir/Desktop/Appc/Repos/Masterss/yeti/Modules/Activity_Indicator/Acceptance/App/temporaryApp/build/android/app/build/outputs/apk/debug/app-debug.apk
Run the same command again
*Actual result* Following error is shown:Failure [INSTALL_FAILED_ALREADY_EXISTS]
*Expected result*
For app to reinstall like on Android29
*Potential related issue in the appium Yeti suite the following error is also sometimes seen when installing the app using adb on Android23 (Android29 works fine).*
[ERROR] Error: [init({"platformName":"Android","platformVersion":"6.0","deviceName":"android-23-x86","app":"/Users/samir/Desktop/Appc/
Repos/Masterss/yeti/Modules/Activity_Indicator/Acceptance/App/temporaryApp/build/android/app/build/outputs/apk/debug/app-debug.apk","avdArgs":"-wipe-data","avd":"android-2
3-x86","avdReadyTimeout":180000,"avdLaunchTimeout":120000,"autoGrantPermissions":true,"appPackage":"com.appcelerator.Acceptance","appActivity":".AcceptanceActivity","uiaut
omator2ServerLaunchTimeout":60000,"uiautomator2ServerInstallTimeout":60000,"automationName":"UiAutomator2","deviceReadyTimeout":60,"newCommandTimeout":600})] The environme
nt you requested was unavailable.
An unknown server-side error occurred while processing the command. Original error: pkg: /data/local/tmp/appium_cache/40f9c7c8ed2607f2e8d6338b9ab41b299111c72c.apk
Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
When using Google's "adb" tool, you need to pass it the "-r" command line argument to tell it to replace/re-install an existing installation. This is documented by Google here... https://developer.android.com/studio/command-line/adb So, just do this...
Note that it's always safe to use the "-r" argument, even if the APK hasn't been installed yet. So, you should always use the "-r" argument. FYI: When you do "appc run" with our CLI, it always sets the "-r" as well.
Closing ticket, above suggestion worked and was able to fix the
[INSTALL_PARSE_FAILED_NO_CERTIFICATES]
error by doing an Environment reset and runningZip - d %APK_Path% 'META-INF/.SF' 'META-INF/.RSA' 'META-INF/*SF'
If the META-INF files in the APK are causing an issue, then you can have the gradle build system exclude them. Create a
build.gradle
file under the project's./platform/android
directory.