Obtain apk files



  • This is a very basic question. I just installed anbox on my Oneplus One but... how do I obtain new apk files for the android apps? For instance, how do I get the apk file for Spotify?



  • @aclifton314
    apkmirror or here`s a bad word , google it



  • I tend to pull the APKs off a second device that still runs android.



  • Or look into installing something like Aurora Store if you want apps from play store.



  • @Ingo Do you mind elaborating on how you pull the APKs off the second device?



  • Found the place where I posted an example: https://forum.fairphone.com/t/ubports-16-04-updates-feature-tests/36656/90?u=ingo

    Short summary:

    • connect the android phone with USB cable and USB debugging enabled
    • list all packages with adb shell pm list packages
    • get the full path for the package name you’re interested in: adb shell pm path com.example.someapp
    • pull the APK using the output of the last command: adb pull /data/app/com.example.someapp /path/to/desired/destination/com.example.someapp.apk


  • Awesome. Thank you!

    Is there a certain place on the ubports phone I need to adb push the app? And to install it on the ubports phone, are these instructions sufficient ?(https://docs.ubports.com/en/latest/userguide/dailyuse/anbox.html)

    EDIT:
    I'm not sure which specific package I should pull as I see multiple ones:

    $ adb shell pm path com.spotify.music
    package:/data/app/com.spotify.music-1/base.apk
    package:/data/app/com.spotify.music-1/split_config.armeabi_v7a.apk
    package:/data/app/com.spotify.music-1/split_config.xhdpi.apk
    

    So I tried the base package, did adb push base.apk /home/phablet/Downloads and then following the Anbox documentation (all commands entered from my PC with my ubports phone connected via USB):

    adb shell
    sudo mount -o rw,remount /
    sudo apt update
    adb install /home/phablet/Downloads/base.apk 
    

    but I get:

    phablet@ubuntu-phablet:~$ adb install /home/phablet/Downloads/base.apk
    adb install /home/phablet/Downloads/base.apk
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    error: device offline
    - waiting for device -
    

    and it just hangs. Any thoughts?



  • @aclifton314
    does your device need to be authorised IE, an "allow " window clicked on ? . To Allow adb connection



  • @Marathon2422 I'm not sure. I just reflashed my OPO (ubports device) to start over. I got anbox reinstalled and adb installed on my OPO:

    phablet@ubuntu-phablet:~$ adb devices
    adb devices
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    List of devices attached
    emulator-5558   offline
    
    phablet@ubuntu-phablet:~$
    

    I can copy the spotify app from my android, to my PC, and push to the OPO (I put it in /home/phablet/Downloads as the instructions suggest).
    on PC:

    $ adb devices
    List of devices attached
    8a8165fa        device
    
    $ adb push base.apk /home/phablet/Downloads
    base.apk: 1 file pushed. 4.4 MB/s (16892152 bytes in 3.634s)
    
    $ adb shell
    phablet@ubuntu-phablet:~$ ls /home/phablet/Downloads
    ls /home/phablet/Downloads
    base.apk
    

    So it seems I can push the apk, but I can't install it:

    $ adb shell
    phablet@ubuntu-phablet:~$ ls /home/phablet/Downloads
    ls /home/phablet/Downloads
    base.apk
    phablet@ubuntu-phablet:~$
    
    phablet@ubuntu-phablet:~$ sudo mount -o rw,remount /
    sudo mount -o rw,remount /
    
    phablet@ubuntu-phablet:~$ sudo apt update
    sudo apt update
    Ign:1 http://repo.ubports.com xenial InRelease
    Hit:2 http://ports.ubuntu.com/ubuntu-ports xenial InRelease
    Hit:3 http://ports.ubuntu.com/ubuntu-ports xenial-updates InRelease
    Hit:4 http://ports.ubuntu.com/ubuntu-ports xenial-security InRelease
    Hit:5 http://repo.ubports.com xenial Release
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    133 packages can be upgraded. Run 'apt list --upgradable' to see them.
    phablet@ubuntu-phablet:~$ adb install /home/phablet/Downloads/base.apk
    adb install /home/phablet/Downloads/base.apk
    error: device offline
    - waiting for device -
    
    

    It just hangs. On the OPO I find:

    phablet@ubuntu-phablet:~$ adb devices
    adb devices
    List of devices attached
    emulator-5558   offline
    

    Don't know if that is helpful or not. Maybe I am doing something wrong? I also don't know if base.apk is even the correct thing to try to install since there were two others choices when I did adb shell pm path com.spotify.music on my android device.



  • IIRC when the adb command shows that the device is offline, try to start one of the pre-installed android apps. That should get it "online".

    If that still doesn't work, there is an alternative method to install apps as described in https://forums.ubports.com/post/12491



  • @Ingo, thank you for the response. Naively, to start a preinstalled android app do I just tap it or is it better to start it with adb some how?



  • Just tap it 😉


Log in to reply