Retrieving Native Code Architecture from an Android App

青春壹個敷衍的年華 提交于 2019-12-13 04:53:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!