Skip to content

lxbzmy/android-apk-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Android APK Parser

Use Android Interface and other tools to parse APK file get manifest. 使用android api 做原型实现的APK包解析,用于J2SE环境中读取APK做验证。

Feature

  • decode manifest.xml in apk.
  • decode resources. in apk.
  • build PackageInfo.
  • get lanucher icon from manifest and resources and to BuffererdImage.

Dependence

  • some AOSP(4.2.2 KikKat,API19) code com.broadwave.android.android.
  • android-apktool repacket to com.broadwave.android.brut.
  • axml util from Android4ME repacket to com.broadwave.android.util.axml.

example

import com.broadwave.android.util.PackageParserUtil.PackageParserUtil()
import com.broadwave.android.content.pm.PackageInfo;
...
//default locale is zh_CN
File f = new File(bash.apk);
//create packageParserUtil;
PackageParserUtil util = new PackageParserUtil();
PackageInfo info = util.parsePackageInfo(f);
//APK info.
assertThat(info.packageName, equalTo("jackpal.androidterm"));
assertThat(info.versionCode, equalTo(53));
assertThat(info.versionName, equalTo("1.0.52"));
assertThat(info.applicationInfo.localizedLabel.toString(),
        equalTo("终端模拟器"));
assertThat(info.applicationInfo.iconImage.getWidth(null), equalTo(96));//icon

see PackageParserUtilTest.java for more.

License

/**
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

[2]:

About

Android APK file parser for J2EE

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages