Search code examples
androidtestingapkadbandroid-tv

Automated Installation of an .apk from the Google Play Store


I'm writing some end-to-end tests of an Android-TV-App using Python and my own implementation of the ADB-Protocol. This works fine so far, I can send commands, get ui-dumps ect.

However, since the app is only available on the Google Play Store (I don't have access to any source code) and I want to update the version of the app every week, I'm wondering how I can do this using ADB.

I thought about following solutions:

  1. Send key events to open play store on the device and navigate to to the installation / update page of the app.
  2. Download the app somehow to the Testmachine and push it to the device by ADB.
  3. Use ADB to directly install a new version of the app on the device.

Whats "best practice" on this and how should i solve my problem?


Solution

  • Download APK locally using Google Play Downloader via Command line and install it with adb.

    $ gplaycli -s 'App Inspector'
    Title                                           Creator            Size      Downloads                 Last Update  AppID                        Version   Rating  
    App Inspector                                   Projectoria        895.04KB  100,000+ downloads        14 Jul 2019  bg.projectoria.appinspector  8         4.53    
    ...
    
    $ gplaycli -d bg.projectoria.appinspector
    
    $ adb install bg.projectoria.appinspector.apk 
    Performing Streamed Install
    Success