问题
I'm working on an app which determines the native code architecture and native libraries used by all the apps installed on the device. It's similar to running the following command.
aapt dump badging <file.apk location>
The package manager doesn't provide information about the native code like this one or the native shared libraries. I can retrieve the native shared libraries that the target app uses with the following code:
try {
Set<String> libs = new HashSet<String>();
String mapsFile = "/proc/" + android.os.Process.myPid() + "/maps";
BufferedReader reader = new BufferedReader(new FileReader(mapsFile));
String line;
while ((line = reader.readLine()) != null) {
if (line.endsWith(".so")) {
int n = line.lastIndexOf(" ");
libs.add(line.substring(n + 1));
}
}
Log.d("Ldd", libs.size() + " libraries:");
for (String lib : libs) {
Log.d("Ldd", lib);
}
} catch (FileNotFoundException e) {
// Do some error handling...
} catch (IOException e) {
// Do some error handling...
}
All I require is the native code architecture used by the app package. I want to determine the compatible native code architecture from app package.
回答1:
You also asked how to get this info via the PackageManager - so see the answer to that post
来源:https://stackoverflow.com/questions/18753578/retrieving-native-code-architecture-from-an-android-app