Wednesday, 11 September 2013

Retreiving Native Code Architecture from an Android App

Retreiving Native Code Architecture from an Android App

I'm working on an app which determines the native code architecture and
native libraries used by the apps installed on the device. Its 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. Any help?

No comments:

Post a Comment