.              .   /      .'. .'   -=  o  =-  .'   '              
 |                           
 |                      
 |=====.                
 |.---.|                
 ||=o=||                
 ||   ||                
 ||   ||               
 ||___||               
 |[:::]|               
 '-----'

Export an APK for migration to another mobile

I needed to install a language application that was no longer available in the official store or on the manufacturer’s website, so I had to export it so I could continue using it on a new phone.

Step 1 – Enable adb debugging on your device

In order to use adb with a device connected via USB, you must enable USB Debugging in the device’s system settings, found in “Developer Options”. On Android 4.2 (API level 17) and later, the Developer Options screen It is hidden by default. To make it visible, enable Developer Options. https://developer.android.com/studio/debug/dev-options?hl=es-419#enable

Install adb

Android Debug Bridge

$ apt install adb

Connect your phone to the computer and validate it

It can be done in several ways but I usually do it with a direct USB connection, enable File Transfer from the phone and then check with:

$ adb devices

With the previous command you should see your phone listed:

$ adb devices
$ daemon not running; starting now at tcp:5037
$ daemon started successfully
$ List of devices attached
$ f48ec6 device

Find the installed application

To list the applications installed on the phone:

$ adb shell pm list packages

if we want to search for example the application “uber”

$ adb shell pm list packages | grep uber

Find the application path

$ adb shell pm list packages -f org.compania.aplicacion

Extract the specific application

Once we have found the path to the application we want to back up or extract from the phone, we use this command:

$ adb pull /data/app/~~randomdata==/com.compania.tracker-Nqrandom_nOhw==/base.apk

which will leave it with the name base.apk to be installed on another compatible Android phone, it doesn’t always work, but that backup can be useful for the same phone in case we reinstall the entire operating system.