Get apk of installed app from Android device

Introduction

The installed applications are /data/app, however you cannot list the listing of this dir except you are rooted or you have insecure adb, as:

drwxrwx--x system   system            2013-08-05 08:28 app

However you can get the app you want as long as you know the file name.

To download you need to execute adb pull filename, ex:

adb pull /data/app/com.example.android.apis-1.apk

How to find the file name

The names of applications are smth like this: com.example.android.apis-1.apk, – the package followed by number (1 or 2).
so you can guess and try.

Another way to get the file name is to execute pm path some.package.name command:

adb shell pm path com.example.android.apis
package:/data/app/com.example.android.apis-1.apk

Another way is form java code:

PackageManager pm = getPackageManager();
List<ApplicationInfo> pkgs =  pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : pkgs) {
    Log.d("PackageInfo", "package :" + packageInfo.packageName);
    Log.d("PackageInfo", "file path:" + packageInfo.sourceDir);
}