天天看點

android 檢視 androidmanifest.xml,檢視 AndroidManifest.xml檔案

裝在Android手機中,用此apk看系統中已安裝應用的AndroidManifest.xml檔案:

android 檢視 androidmanifest.xml,檢視 AndroidManifest.xml檔案
android 檢視 androidmanifest.xml,檢視 AndroidManifest.xml檔案

View Codeprotected boolean configForPackage(String packageName) {

if (packageName == null || packageName == "")

packageName = "android";

AssetManager initAM = mCurAm;

Resources initRes = mCurResources;

try {

mCurAm = createPackageContext(packageName, 0).getAssets();

mCurResources = new Resources(mCurAm, getResources()

.getDisplayMetrics(), null);

} catch (NameNotFoundException name) {

Toast.makeText(this, "Error, couldn't create package context:"

+ name.getLocalizedMessage(), Toast.LENGTH_LONG);

mCurAm = initAM;

mCurResources = initRes;

return false;

} catch (RuntimeException unexpected) {

Log.e(MANIFEST_TAG, "error configuring for package:" + packageName

+ "" + unexpected.getMessage());

mCurAm = initAM;

mCurResources = initRes;

return false;

}

return true;

}

protected void updateView() {

this.mOut.setText("");

try {

XmlResourceParser xml = null;

xml = mCurAm.openXmlResourceParser("AndroidManifest.xml");

this.mInput.setText("/sdcard/" + getPkgName() + ".txt");

this.mOut.append(getXMLText(xml, mCurResources));

} catch (IOException ioe) {

this.showError("Reading XML", ioe);

}

}

把apk放在PC中,配置好jdk環境後輸入:

java –jar apktool.jar file_path.apk

嫌麻煩的可用第三方內建界面工具:APK改之理。

aapt d[ump] [--values] WHAT file.{apk} [asset [asset ...]]

badging          Print the label and icon for the app declared in APK.

permissions      Print the permissions from the APK.

resources        Print the resource table from the APK.

configurations   Print the configurations in the APK.

xmltree          Print the compiled xmls in the given assets.

xmlstrings       Print the strings of the given compiled xml assets

檢視apk包的packageName、versionCode、applicationLabel、launcherActivity、permission等各種詳細資訊

aapt dump badging

檢視權限

aapt dump permissions

檢視資源清單

aapt dump resources

檢視apk配置資訊

aapt dump configurations

檢視指定apk的指定xml檔案。

a.以樹形結構輸出的xml資訊。

aapt dump xmltree res/***.xml

如:aapt dump xmltree AndroidManifest.xml可檢視應用的該檔案

b. 輸出xml檔案中所有的字元串資訊。

aapt dump xmlstrings res/***.xml

java -jar APKParser.jar 可輸出格式化後的該應用的AndroidManifest.xml檔案