Build APKs for Android Emulators and devices
Learn how to configure and install an .apk for Android Emulators and devices when using EAS Build.
The default file format used when building Android apps with EAS Build is an Android App Bundle (AAB/.aab). This format is optimized for distribution to the Google Play Store. However, AABs can’t be installed directly on your device. To install a build directly to your Android device or emulator, you need to build an Android Package (APK/.apk) instead.
Configuring a profile to build APKs
To generate an .apk, modify the eas.json by adding one of the following properties in a build profile:
- developmentClient to true (default)
- android.buildType to apk
- android.gradleCommand to :app:assembleRelease , :app:assembleDebug or any other gradle command that produces .apk
"build": "preview": "android": "buildType": "apk" > >, "preview2": "android": "gradleCommand": ":app:assembleRelease" > >, "preview3": "developmentClient": true >, "production": > > >
Now you can run your build with the following command:
— eas build -p android —profile preview
Remember that you can name the profile whatever you like. We named the profile preview . However, you can call it local , emulator , or whatever makes the most sense for you.
Installing your build
Emulator (virtual device)
If you haven’t installed or run an Android Emulator before, follow the Android Studio emulator guide before proceeding.
Once your build is completed, the CLI will prompt you to automatically download and install it on the Android Emulator. When prompted, press Y to directly install it on the emulator.
In case you have multiple builds, you can also run the eas build:run command at any time to download a specific build and automatically install it on the Android Emulator:
— eas build:run -p android
The command also shows a list of available builds of your project. You can select the build to install on the emulator from this list. Each build in the list has a build ID, the time elapsed since the build creation, the build number, the version number, and the git commit information. The list also displays invalid builds if a project has any.
For example, the image below lists the build of a project:
When the build’s installation is complete, it will appear on the home screen. If it’s a development build, open a terminal window and start the development server by running the command npx expo start . For SDK 48 and lower, use the —dev-client flag with the command.
Running the latest build
Pass the —latest flag to the eas build:run command to download and install the latest build on the Android Emulator:
How do I get an apk file from an Android device?
How do I get the apk file from an android device? Or how do I transfer the apk file from device to system?
58k 27 27 gold badges 114 114 silver badges 156 156 bronze badges
asked Oct 27, 2010 at 12:06
8,399 8 8 gold badges 39 39 silver badges 54 54 bronze badges
Can you change the accepted answer to this one? stackoverflow.com/a/18003462/238753 It has over 10x the number of votes and makes it super easy
Oct 22, 2020 at 23:23
26 Answers 26
None of these suggestions worked for me, because Android was appending a sequence number to the package name to produce the final APK file name. On more recent versions of Android (Oreo and Pie), an unpredictable random string is appended. The following sequence of commands is what worked for me on a non-rooted device:
1) Determine the package name of the app, e.g. «com.example.someapp». Skip this step if you already know the package name.
adb shell pm list packages
Look through the list of package names and try to find a match between the app in question and the package name. This is usually easy, but note that the package name can be completely unrelated to the app name. If you can’t recognize the app from the list of package names, try finding the app in Google Play using a browser. The URL for an app in Google Play contains the package name.
2) Get the full path name of the APK file for the desired package.
adb shell pm path com.example.someapp
The output will look something like
package:/data/app/com.example.someapp-2.apk
or
package:/data/app/com.example.someapp-nfFSVxn_CTafgra3Fr_rXQ==/base.apk
3) Using the full path name from Step 2, pull the APK file from the Android device to the development box.
adb pull /data/app/com.example.someapp-2.apk path/to/desired/destination
answered Aug 1, 2013 at 20:01
23.5k 5 5 gold badges 44 44 silver badges 48 48 bronze badges
I used the above to create a bash script that makes it a one-liner: gist.github.com/anonymous/9109984
Feb 20, 2014 at 9:32
pm list packages supports the -f flag, which lists the location of the .apk for you, like package:/data/app/com.google.android.apps.maps-1.apk=com.google.android.apps.maps . The built-in pm help is useless, but pm can also filter types of packages too, see developer.android.com/studio/command-line/adb.html#pm for more info. EDIT: just noticed that the answer below says this, but that answer isn’t nearly as upvoted as this one.
Jan 3, 2017 at 14:57
Doesn’t work for me. I get the following error: adb: error: remote object ‘/data/app/path.of.the.app-2/base.apk’ does not exist . If I browse these folders with a file browser, the folders are empty.
Feb 9, 2018 at 13:56
I had a similar problem as @Bevor, when pulling I got the error that the apk «does not exist». I fixed it by using adb shell and then cp PathToApk /sdcard/ and then copying from the sdcard.
Oct 4, 2018 at 23:34
I had a similar problem as @Bevor, this solves it by using the downloads folder as an intermediate: stackoverflow.com/a/43157127/6067948
Mar 18, 2020 at 10:45
Use adb. With adb pull you can copy files from your device to your system, when the device is attached with USB.
Of course you also need the right permissions to access the directory your file is in. If not, you will need to root the device first.
If you find that many of the APKs are named «base.apk» you can also use this one line command to pull all the APKs off a phone you can access while renaming any «base.apk» names to the package name. This also fixes the directory not found issue for APK paths with seemingly random characters after the name:
for i in $(adb shell pm list packages | awk -F':' ''); do adb pull "$(adb shell pm path $i | awk -F':' '')" mv base.apk $i.apk &> /dev/null done
If you get «adb: error: failed to stat remote object» that indicates you don’t have the needed permissions. I ran this on a NON-rooted Moto Z2 and was able to download ALL the APKs I did not uninstall (see below) except youtube.
adb shell pm uninstall --user 0 com.android.cellbroadcastreceiver
(to view users run adb shell pm list users) This is a way to remove/uninstall (not from the phone as it comes back with factory reset) almost ANY app WITHOUT root INCLUDING system apps (hint the annoying update app that updates your phone line it or not can be found by grepping for "ccc")
847 2 2 gold badges 12 12 silver badges 23 23 bronze badges
answered Oct 27, 2010 at 12:12
Maurits Rijk Maurits Rijk
9,839 2 2 gold badges 36 36 silver badges 53 53 bronze badges
THanks Maurits Rijk. Please assist me. I want to copy the iTwips.apk file from the device to system. I am using the following command. is it correct ? I got error "Android2.2Froyo/sdcard/iTwips.apk" does not exits. /Users/bbb/Android/android-sdk-mac_86/tools/adb pull Android2.2Froyo/sdcard/iTwips.apk /Users/bbb Thanks is advance.
Oct 27, 2010 at 13:17
On my device (Android 2.1) the command would be "adb pull /sdcard/test.jpg" to copy test.jpg from my sd card to the current dir. Please locate your iTwips.apk file first using "adb shell". This start a shell on your device and you can use the standard Unix commands like ls and cd to browse your directories.
Oct 27, 2010 at 13:56
@Finder @Maurits Rijk Actually, you don't have to root the device just to pull the apk. As long as you know the full path of that apk. If the apk is installed, find the full path by first looking at the package name with adb shell pm list packages , and its full path adb shell pm path your.package.name then from your pc, you can simply adb pull /full/path/to/your.apk
Jun 9, 2016 at 5:10
For instructions, see answer from Yojimbo.
Jun 5, 2018 at 18:59
Worth noting that if some APKs have the same name, this will overwrite them, so you really need to do the commands specified by yojimbo instead.
Feb 20, 2020 at 2:25
No root is required:
This code will get 3rd party packages path with the name so you can easily identify your APK
adb shell pm list packages -f -3
the output will be
now pull that package using below code:
adb pull /data/app/XX.XX.XX.apk
if you executed above cmd in C:>\ , then you will find that package there.
answered Aug 30, 2013 at 6:45
Faris Al-Abed Faris Al-Abed
1,481 1 1 gold badge 9 9 silver badges 2 2 bronze badges
For some reason I cannot find APKs in my /data/app/ directory. There is always a subdirectory there.
Apr 25, 2016 at 16:36
for system apps use -f -s instead of -f -3
Apr 2, 2017 at 9:53
If you have a lot of apks, grep can help narrow down the output from the first command, if you know any word in the package name: adb shell pm list packages -f | grep
Oct 14, 2020 at 14:20
Steps to Download APK from Device to Desktop
A) Make sure that your running (emulator/real Device). To check use this command
adb devices
B) Select all the available package list installed in your device. You can use grep command to select the specific package you intend to download.
adb shell pm list packages adb shell pm list packages -f -3
Output (List of available packages )
package:/data/app/com.example.mytestapplication-sOzKi5USzfbYLPNDmaaK6g==/base.apk=com.example.mytestapplication package:/data/app/com.example.myapplication-nd1I4FGnTZnQ9PyRbPDHhw==/base.apk=com.example.myapplication
C) Copy the package (which you like to download) from the above link. Form our case I choose this (com.example.myapplication) package
Syntax : adb shell pm path [your_package_name] Command: adb shell pm path com.example.myapplication
package:/data/app/com.example.myapplication-nd1I4FGnTZnQ9PyRbPDHhw==/base.apk
D) Finally, To download APK from your (emulator/real device)
Syntax : adb pull /data/app/[your_package_name]-1/base.apk [your_destination_path] Command: adb pull /data/app/com.example.myapplication-3j4CVk0Tb2gysElgjz5O6A==/base.apk /Users/$(whoami)/Documents/your_apk.apk
Example: Trying to pull this CertInstaller.apk file in your local machine ( Mac )
adb pull /system/app/CertInstaller/CertInstaller.apk /Users/$(whoami)/Documents/APK/download_apk/
E) Confirm in your local directory
ls -la /Users/$(whoami)/Documents/
2,590 1 1 gold badge 19 19 silver badges 31 31 bronze badges
answered Jan 28, 2019 at 3:42
3,796 1 1 gold badge 21 21 silver badges 15 15 bronze badges
The objective is to extract a single apk, yet in step 4 you pull two additional files without explanation or previous reference.
Feb 25, 2019 at 14:05
I modified this post by clarifying every step.hope this modification will be helpful and easy to understand.
Feb 26, 2019 at 0:35
Also, what's step C for? You already get the package path from pm list packages . You only need that if you only know the apk identifier (but not the package path).
Sep 7, 2021 at 13:10
I've seen that many solutions to this problem either you have to root your phone or you have to install an app. Then after much googling I got this solution for non rooted/rooted phones.
To list which apps you got so far.
adb shell pm list packages
Then you may select an app, for instance twitter
adb backup -apk com.twitter.android
An important thing here is to not set up a password for encrypt your backup
This is going to create a file named as backup.ap, but you still can't open it. For this you got to extract it again but using the dd command.
dd if=backup.ab bs=24 skip=1 | openssl zlib -d > backup.tar
After this all you have to do is to extract the tar content and it's done.
Hope it works for you guys
answered Jun 16, 2013 at 16:49
Paulo Miguel Almeida Paulo Miguel Almeida
2,134 31 31 silver badges 36 36 bronze badges
From blog.shvetsov.com/2013/02/…, if your openssl doesn't have zlib, this might work: dd if=backup.ab bs=1 skip=24 | python -c "import zlib,sys;sys.stdout.write(zlib.decompress(sys.stdin.read()))" | tar -xvf -
Sep 3, 2013 at 21:55
This is what worked for me, not the procedure in the accepted answer. And it really helped me today when I needed APK of one of my old apps but it was not available to me other than from my phone.
Jul 15, 2014 at 17:53
Here are more information if your openssl lacks zlib support: stackoverflow.com/questions/29830981/…
Sep 26, 2017 at 8:41
If, with @kodi 's comment you get UnicodeDecodeError: 'utf-8' codec can't decode byte 0xda in position 1: invalid continuation byte , then replace python by python2 in the command.
Mar 7, 2022 at 22:54
On some vendors, it is impossible to backup the APK without setting a password. Didn't work for me on the Samsung phone.
Jul 29, 2022 at 11:06
C:\Users\xyz>adb shell pm list packages -f | findstr whatsapp package:/data/app/com.whatsapp-1/base.apk=com.whatsapp C:\Users\xyz>adb pull /data/app/com.whatsapp-1/base.apk Desktop /data/app/com.whatsapp-1/base.apk: 1 f. 13.8 MB/s (32803925 bytes in 2.269s)
answered Feb 13, 2018 at 11:57
651 2 2 gold badges 6 6 silver badges 15 15 bronze badges
This is the most straightforward way in my opinion. Thanks!
Feb 28, 2018 at 18:23
guys using linux or mac instead of findstr use grep
Feb 21, 2019 at 11:42
One liner which works for all Android versions:
adb shell 'cat `pm path com.example.name | cut -d':' -f2`' > app.apk
answered Jun 10, 2018 at 7:58
Vitaly Dyatlov Vitaly Dyatlov
1,872 14 14 silver badges 24 24 bronze badges
@AlexP. what did you want to tell by the link above?
Jun 10, 2018 at 15:05
On unix systems, you can try this function:
function android_pull_apk() < if [ -z "$1" ]; then echo "You must pass a package to this function!" echo "Ex.: android_pull_apk \"com.android.contacts\"" return 1 fi if [ -z "$(adb shell pm list packages | grep $1)" ]; then echo "You are typed a invalid package!" return 1 fi apk_path="`adb shell pm path $1 | sed -e 's/package://g' | tr '\n' ' ' | tr -d '[:space:]'`" apk_name="`adb shell basename $| tr '\n' ' ' | tr -d '[:space:]'`" destination="$HOME/Documents/Android/APKs" mkdir -p "$destination" adb pull $ $ echo -e "\nAPK saved in \"$destination/$apk_name\"" >
- Example: android_pull_apk com.android.contacts
- Note: To identify the package: adb shell pm list packages
answered Apr 16, 2017 at 21:34
Pedro Rodrigues Pedro Rodrigues
1,702 15 15 silver badges 19 19 bronze badges
Completing @Yojimbo 's answer, this is what I did (Linux/Mac only, will not work out of the box on Windows. maybe in git's bash shell):
for i in $(adb shell pm list packages -f -3 | cut -d= -f 1 | cut -d ":" -f 2); do adb pull $i; done
This is ugly bash, but works 🙂
EDIT: It no longer works on AndroidM: all files are named "base.apk" under another dir. Should be "trivial" to fix.
answered Dec 9, 2015 at 8:59
8,988 9 9 gold badges 47 47 silver badges 70 70 bronze badges
Try this one liner bash command to backup all your apps:
for package in $(adb shell pm list packages -3 | tr -d '\r' | sed 's/package://g'); do apk=$(adb shell pm path $package | tr -d '\r' | sed 's/package://g'); echo "Pulling $apk"; adb pull -p $apk "$package".apk; done
This command is derived from Firelord's script. I just renamed all apks to their package names for solving the issue with elcuco's script, i.e the same base.apk file getting overwritten on Android 6.0 "Marshmallow" and above.
Note that this command backs up only 3rd party apps, coz I don't see the point of backing up built-in apps. But if you wanna backup system apps too, just omit the -3 option.
answered Jan 1, 2018 at 18:17
Rohan 'HEXcube' Villoth Rohan 'HEXcube' Villoth
283 3 3 silver badges 12 12 bronze badges
@Pieter Not likely. This was tested before split APKs were common. What this script does is pull the base.apk and rename it to package name of the app.
Jun 17, 2020 at 12:21
@Pieter You'll need a modification of the script that pulls all apks from that directory and rename them in a sequence or maybe copy them to a directory.
Jun 17, 2020 at 12:23
Does it work if you just adb install all of the APKs for that app separately to restore it?
Jun 17, 2020 at 17:52
According to this stackoverflow.com/questions/55212788/… , you've to use a new command 'adb install-multiple apk1 apk2 . '
Jul 13, 2020 at 18:32
As said above, you can get the apk by using the pull command in adb.
Since, you are talking about your installed applications, go ahead and look in the /data/app directory of your Android filesystem. You will find the APK's there.
Then use the adb command - adb pull /data/data/appname.apk
answered May 30, 2012 at 11:39
aditya.gupta aditya.gupta
585 3 3 gold badges 7 7 silver badges 15 15 bronze badges
- Open the app you wish to extract the apk from on your phone.
- Get the currently opened app with:
adb shell dumpsys activity activities | grep mFocusedActivity
adb shell pm path
4.Copy the path you got to the sdcard directory
adb shell cp /data/app/ /sdcard
adb pull /sdcard/base.apk
Edit
If step no 2 doesn't work use this:
adb shell dumpsys window windows | grep mCurrentFocus
answered Dec 10, 2018 at 12:30
3,127 25 25 silver badges 22 22 bronze badges
In June of 2023, use:
adb shell pm list packages --user 0
to list the package names, then:
adb shell pm path your.package.name adb pull /data/app/your/path/to/package/foo.apk
to get the package(s).
answered Jun 12 at 17:55
user3486184 user3486184
2,207 3 3 gold badges 27 27 silver badges 30 30 bronze badges
Worked for me (Aug/23). Thanks!
Aug 13 at 21:10
got base.apk + arm64_v8a.apk + xhdpi.apk instead of single one
Aug 25 at 9:06
If there are multiple APKs, it's an Android app bundle (AAB). You get only the APKs specific to your device.
Aug 26 at 10:42
If you know (or if you can "guess") the path to the .apk (it seems to be of the format /data/app/com.example.someapp-.apk to , then you can just copy it from /data/app as well. This worked even on my non-rooted, stock Android phone.
Just use a Terminal Emulator app (such as this one) and run:
# step 1: confirm path ls /data/app/com.example.someapp-1.apk # if it doesn't show up, try -2, -3. Note that globbing (using *) doesn't work here. # step 2: copy (make sure you adapt the path to match what you discovered above) cp /data/app/com.example.someapp-1.apk /mnt/sdcard/
Then you can move it from the SD-card to wherever you want (or attach it to an email etc). The last bit might be technically optional, but it makes your life a lot easier when trying to do something with the .apk file.
answered Apr 25, 2014 at 7:57
9,063 6 6 gold badges 33 33 silver badges 59 59 bronze badges
The procedures outlined here do not work for Android 7 (Nougat) [and possibly Android 6, but I'm unable to verify]. You can't pull the .apk files directly under Nougat (unless in root mode, but that requires a rooted phone). But, you can copy the .apk to an alternate path (say /sdcard/Download) on the phone using adb shell, then you can do an adb pull from the alternate path.
answered Dec 2, 2016 at 13:53
815 8 8 silver badges 12 12 bronze badges
The accepted answer (including the adb shell commands from @Isa A's comment) worked fine for me on Android 7.1.1, not rooted.
Dec 22, 2016 at 14:54
All these answers require multiple steps for each apk file retrieved from the device. 1. determine package name, 2. find the file, and 3. download it. I built a simple apk_grabber python script to do this for any app that matches a given regex, and then decompiles those apks into jar files.
answered Apr 17, 2015 at 21:58
Jeff Brateman Jeff Brateman
3,239 2 2 gold badges 20 20 silver badges 27 27 bronze badges
Here's how you do it:
Download and install APK Extractor in your device. It is free, and is compatible in almost all of the Android devices. Another plus point is it does not even require root or anything to work. After you have it installed, launch it. There you will see a list of apps which are in your device, which include the apps you’ve installed later, along with the system apps. Long press any app you want to extract (you can select multiple or all apps at once), and click on the extract option you see in the top. You will also have the option to share via Bluetooth or messaging. You’re done, you will see the extracted apps as AppName_AppPackage_AppVersionName_AppVersionCode.apk, which will be saved in the path /sdcard/ExtractedApks/ by default.
answered Sep 16, 2014 at 10:11
Pramod Mahato Pramod Mahato
43 1 1 bronze badge
I got a does not exist error
Here is how I make it works
adb shell pm list packages -f | findstr zalo package:/data/app/com.zing.zalo-1/base.apk=com.zing.zalo adb shell mido:/ $ cp /data/app/com.zing.zalo-1/base.apk /sdcard/zalo.apk mido:/ $ exit adb pull /sdcard/zalo.apk Desktop /sdcard/zalo.apk: 1 file pulled. 7.7 MB/s (41895394 bytes in 5.200s)
answered Jan 8, 2019 at 16:51
vanduc1102 vanduc1102
5,897 1 1 gold badge 47 47 silver badges 43 43 bronze badges
This helped me on a Android 7.0 Huawei device.
Jul 5, 2020 at 11:11
I haven't used code to pull .apk file from mobile but i have been using software to extract .apk file from mobile and software i have used are below with google play link:
- ES File Explorer File Manager
- ASTRO Cloud & File Manager 3.Software Data Cable
Hope it helps You.
answered Aug 14, 2013 at 11:39
surhidamatya surhidamatya
2,449 32 32 silver badges 56 56 bronze badges
I used ES File Explorer. I'm not rooted. I just went to Tools -> App Manager and long-pressed the app I wanted the APK for. This selected the app (and allowed me to select others). I think pressed the Share button and was able to send the APK to myself (using Push Bullet, but what ever works for you).
May 23, 2014 at 21:10
If you are not rotted then you can try App backup and restore play.google.com/store/apps/details?id=mobi.infolife.appbackup
May 27, 2014 at 6:36
Using ES File Explorer File Manager worked on my Nexus 6p - Thank-you!
Jun 11 at 22:18
No Root and no ADB tools required method. Install MyAppSharer app from the play store.
answered Dec 21, 2018 at 17:48
669 7 7 silver badges 13 13 bronze badges
This App by "Jones Chi" has (as of December 2020) 10M+ downloads, 147K reviews with an average rating of 4.6, and it was last updated on November 13th, 2017, just in case anybody was wondering.
Dec 19, 2020 at 20:50
I really liked all these answers. Most scripts to export and rename all of them were written in Bash. I made a small Perl script which does the same (which should work both in Perl for windows and linux, only tested on Ubuntu).
download-apk.pl
#!/usr/bin/perl -w # Automatically export all available installed APK's using adb use strict; print "Connect your device. \n"; system("adb", "wait-for-device"); open(my $OUT, '-|', 'adb', 'shell', 'pm', 'list', 'package', '-f'); my $count = 0; while(my $line = ) < $line =~ s/^\s*|\s*$//g; my ($type, $path, $package) = $line =~ /^(.*?):(.*)=(.*)$/ ? ($1,$2,$3) : die('invalid line: '.$line); my $category = $path =~ /^\/(.*?)\// ? $1 : 'unknown'; my $baseFile = $path =~ /\/([^\/]*)$/ ? $1 : die('Unknown basefile in path: '.$path); my $targetFile = "$category-$package.apk"; print "$type $category $path $package $baseFile >> $targetFile\n"; system("adb", "pull", $path); rename $baseFile, $targetFile; >
- Make sure adb(.exe) is in your path or same directory
- Connect your phone
- Run download-apk.pl
The output is something similar to:
# ./download-apk.pl Connect your device. * daemon not running. starting it now on port 5037 * * daemon started successfully * package system /system/app/YouTube/YouTube.apk com.google.android.youtube YouTube.apk >> system-com.google.android.youtube.apk 5054 KB/s (11149871 bytes in 2.154s) package data /data/app/com.ghostsq.commander-1/base.apk com.ghostsq.commander base.apk >> data-com.ghostsq.commander.apk 3834 KB/s (1091570 bytes in 0.278s) package data /data/app/de.blinkt.openvpn-2/base.apk de.blinkt.openvpn base.apk >> data-de.blinkt.openvpn.apk 5608 KB/s (16739178 bytes in 2.914s) etc.
answered Jan 22, 2019 at 15:48
Gerben Versluis Gerben Versluis
546 6 6 silver badges 7 7 bronze badges
wanna very, very comfortable 1 minute solution?
tap "apps", choose one and tap "backup". it will end up on your file system in app_backup folder 😉
answered Feb 23, 2018 at 10:11
user3350906 user3350906
150 2 2 silver badges 11 11 bronze badges
Yet another bash script (i.e. will work for most unix-based systems). Based on the answer by Pedro Rodrigues, but is slightly easier to use.
Improvements over Pedro's version:
- Original approach did not work for me on Android 7: adb pull kept complaining about no such file or directory while adb shell could access the file. Hence I used different approach, with temporary file.
- When launched with no arguments, my script will just list all available packages. When partial package name is provided, it will try to guess the full package name. It will complain if there are several possible expansions.
- I don't hardcode destination path; instead APKs are saved to current working directory.
Save this to an executable file:
#!/bin/bash # Obtain APK file for given package from the device connected over ADB if [ -z "$1" ]; then echo "Available packages: " adb shell pm list packages | sed 's/^package://' echo "You must pass a package to this function!" echo "Ex.: android_pull_apk \"com.android.contacts\"" exit 1 fi fullname=$(adb shell pm list packages | sed 's/^package://' | grep $1) if [ -z "$fullname" ]; then echo "Could not find package matching $1" exit 1 fi if [ $(echo "$fullname" | wc -l) -ne 1 ]; then echo "Too many packages matched:" echo "$fullname" exit 1 fi echo "Will fetch APK for package $fullname" apk_path="`adb shell pm path $fullname | sed -e 's/package://g' | tr '\n' ' ' | tr -d '[:space:]'`" apk_name="`basename $ | tr '\n' ' ' | tr -d '[:space:]'`" destination="$.apk" tmp=$(mktemp --dry-run --tmpdir=/sdcard --suffix=.apk) adb shell cp "$" "$tmp" adb pull "$tmp" "$destination" adb shell rm "$tmp" [ $? -eq 0 ] && echo -e "\nAPK saved in \"$destination\""
