All the people of the Earth know:
A)/data/app/directory itself to Su's access rights, so can not new File ("/data/app");
Maybe you don't know.Of
B)When the initial installation, the file is guaranteed to exist:Data/app + [package name].apkAfter overwriting the installation n times, the file name is:Data/app + [package name]-n.apk
Enter the/data/app/directory with ADB shell
Impressively found that even if the/data/app directory itself is inaccessible, but the directory of files actually have Read permission!. It is certain that there must be a way to access the files in this directory.
after one hours of Android source search, found the following methods:
[Java]View Plaincopy
- file = new file (Getpackagemanager (). Getapplicationinfo (" Com.uc.addon.qrcodegenerator ", 0). SourceDir);
Here Getpackagemanager is the method under the context, do not need to be discussed, SourceDir returned the full apk path, including the nasty things like-N.
and direct access to the file under this path, there is no permission problem.
Reprint: http://blog.csdn.net/zys871228/article/details/12746831
Android Access/data/app/under File method