hsiafan / apk-parser Goto Github PK
View Code? Open in Web Editor NEWApk parser for java
License: BSD 2-Clause "Simplified" License
Apk parser for java
License: BSD 2-Clause "Simplified" License
如果没时间修改,我可以帮忙贡献代码
Hi,
I would like know how to get launch activity from APK?
I checked ApkMeta.java
, but looks like no such method to get launch activity.
please advise.
The ApkParser
fails with a ParserException
if given an APK with no resource table. While most normal applications have such a resource table, several system applications don't, e.g. the Smoke-Test app pre-installed on the emulator (can be found at /data/app/SmokeTestApp.apk
).
StreamUtil's readLen16 is supposed to read a length composed of one or two unsigned shorts, as this comment in the source also mentions. However, it seems to be reading an signed short and then an unsigned byte, therefore missing one byte. The problem is slightly masked by the byte ordering, causing it to work unless you have very large values.
after change some in menifest file how to compress back to binary xml to put it and recompile to .apk file
java.lang.StackOverflowError: null
at java.nio.HeapByteBuffer.getShort(HeapByteBuffer.java:310) ~[na:1.8.0_91]
at net.dongliu.apk.parser.utils.Buffers.readUShort(Buffers.java:24) ~[apk-parser-2.1.2.jar:na]
at net.dongliu.apk.parser.struct.resource.Type.readResourceEntry(Type.java:48) ~[apk-parser-2.1.2.jar:na]
at net.dongliu.apk.parser.struct.resource.Type.getResourceEntry(Type.java:41) ~[apk-parser-2.1.2.jar:na]
I use the 2.1.2 version, and I've no problem with a lot of apks.
With the attached file a StackOverflowError occurs.
I did a test with apktool and it extract the manifest, so I think that the manifest is well formed.
BE CAREFUL, IT'S A MALWARE!!!
ba4a6db3479cfd84dcf47236a0613763.apk
I found that the icon name is null for the following attached apk.
Version 2.1.1 works fine for this apk.
Version 2.1.2 results in the following exception: java.lang.NumberFormatException: For input string: "0x20000"
Version 2.1.3 onwards results in an empty icon name.
The parser is throwing the following exceptions:
net.dongliu.apk.parser.exception.ParserException: Unexpected chunk type:16188
net.dongliu.apk.parser.exception.ParserException: Unexpected chunk type:8508
16188 may be caused when attempting to parse a non-binary XML file. Does this mean the APK is non-compliant?
https://code.google.com/p/android/issues/detail?id=211783
I could not find anything about chunk type: 8508
I just checked ApkParser.verifyApk()
. What does this function actually do? It looks like it loops and does nothing.
while (entries.hasMoreElements()) {
JarEntry e = entries.nextElement();
if (e.isDirectory()) {
continue;
}
InputStream in = jarFile.getInputStream(e);
try {
// Read in each jar entry. A security exception will be thrown if a signature/digest check fails.
int count;
while ((count = in.read(buffer, 0, buffer.length)) != -1) {
// Don't care
}
} catch (SecurityException se) {
return ApkSignStatus.incorrect;
} finally {
in.close();
}
}
Is there any way to get the value of launchable-activity?
Currently I add some stupid codes in ApkMetaConstructor after if (currentTag.equals("uses-permission")
:
else if (name.equals("name")) {
if (!isLaunchableActivitySetted && (
value.equals("android.intent.action.MAIN") ||
value.equals("android.intent.category.LAUNCHER") )) {
apkMeta.setLaunchableActivity(launchableActivity);
isLaunchableActivitySetted = true;
} else {
launchableActivity = value;
}
}
}
I am sure it will always work :-[
btw, some lines are added to R.style.html. I generated a new one yesterday:
https://dl.dropboxusercontent.com/u/1652957/r_styles.conf
my gradle version:
/mnt/windows_share/download/apk-parser-master$ gradle --version
Build time: 2013-11-19 08:20:02 UTC
Build number: none
Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.6.0_37 (Sun Microsystems Inc. 20.12-b01)
OS: Linux 3.8.0-19-generic amd64
/mnt/windows_share/download/apk-parser-master$ gradle
FAILURE: Build failed with an exception.
Where:
Build file '/mnt/windows_share/download/apk-parser-master/build.gradle' line: 44
What went wrong:
A problem occurred evaluating root project 'apk-parser-master'.
No such property: sonatypeUsername for class: org.gradle.api.publication.maven.internal.ant.DefaultGroovyMavenDeployer
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 2.694 secs
Suppose all I need is to parse the APK files to get their intent-filters, can you please suggest what I could do to make it work faster, and with less memory usage ?
So far, in order to make it work this way, I've made "parseResourceTable" do nothing, which made parsing about 5 times faster and also use much less memory.
This is good, but I'd like to know if there is even more that I can do.
Exception in thread "main" java.io.IOException: target pos less the current
at net.dongliu.apk.parser.io.TellableInputStream.advanceIfNotRearch(TellableInputStream.java:83)
at net.dongliu.apk.parser.parser.DexParser.readStrings(DexParser.java:102)
at net.dongliu.apk.parser.parser.DexParser.parse(DexParser.java:56)
at net.dongliu.apk.parser.ApkParser.parseDexClass(ApkParser.java:149)
at net.dongliu.apk.parser.ApkParser.getDexClasses(ApkParser.java:125)
...
依旧是上次的apk:https://dl.dropboxusercontent.com/u/1652957/sample_applabel.apk
If I set the following for the default locale it works as expected:
parser.setPreferredLocale(Locale.forLanguageTag(""));
Maybe you should have Locale.forLanguageTag("")
be the default locale so it gets the strings in /res/values/strings.xml.
When parsing XML files android:id is always android:id="false"
. Other attributes are also wonky.
I downloaded the latest version from maven central and just parsed some APK files. The output language is not my default locale (english).
Example: I parse an XML file and my system locale is english. I expect ApkParser to retrieve the English string however it retrieved the Chinese (or some other) translation instead:
Original XML:
android:text="@string/changelog"
Expected results from ApkParser:
android:text="Changelog"
What I get:
android:text="更新日誌"
From my tests it looks like apk-parser is getting the last translated string from values in descending order. I have yet to look through the code for a possible fix.
Most Android XML files (like AndroidManifest.xml) only have a single namespace, but some can have multiple. For example, res/menu/main.xml
can have the following content:
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.hello.helloapp.app.MainActivity" >
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
Also, I have been unable to find any instances of this behavior so far, but it should be possible for the namespaces to appear between elements, too.
For example, this seems to be valid:
<menu xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="com.example.hello.helloapp.app.MainActivity" >
<item xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never" />
</menu>
It should also be possible to have an XML file with zero namespaces (like perhaps res/values/strings.xml
):
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">HelloApp</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>
not just a icon file name
try (ApkFile apkFile = new ApkFile(new File(filePath))) {
System.out.println(apkMeta.getLabel());
System.out.println(apkMeta.getPackageName());
System.out.println(apkMeta.getVersionCode());
for (UseFeature feature : apkMeta.getUsesFeatures()) {
System.out.println(feature.getName());
}
}
应该为:
try (ApkFile apkFile = new ApkFile(new File(filePath))) {
ApkMeta apkMeta=apkFile.getApkMeta();
System.out.println(apkMeta.getLabel());
System.out.println(apkMeta.getPackageName());
System.out.println(apkMeta.getVersionCode());
for (UseFeature feature : apkMeta.getUsesFeatures()) {
System.out.println(feature.getName());
}
}
Could you please add API to count all available methods?
raw:
<meta-data android:name="TINKER_ID" android:value="1.0" />
apkParser.getManifestXml() return
<meta-data android:name="TINKER_ID" android:value="{4:1065353216}" />
I try to use the tool to obtain AndroidManifest.xml of an apk file. But attribute with boolean type are all set to "false" while the original value should be "true"...
demo code:
try {
ApkMeta apkMeta = ApkParsers.getMetaInfo(apkFile);
JSONObject jsonObject = new JSONObject();
jsonObject.put("pkg_name", apkMeta.getPackageName());
jsonObject.put("file_name", uploadFile.getFileName());
jsonObject.put("file_size", uploadFile.getFile().length());
jsonObject.put("version_name", apkMeta.getVersionName());
jsonObject.put("version_code", apkMeta.getVersionCode());
jsonObject.put("file_md5", CodecKit.MD5(apkFile));
renderOkJson(jsonObject);
} finally {
boolean flag = apkFile.delete();
System.out.println(flag);
}
Why flag always be "false"?
Thanks for the library!
It would be nice if we could extract resources for different screen densities.
Can you support multiple dex parsing? My system is Android 4.4, and I want to parse classes2.dex
The apk meta parser fails to parse the icon name and label for the attached apk file, although it seems to be present correctly in the application line.
example.zip
Hi,
I am trying to use this in Eclipse to retrieve permissions from any .APK file. But when I am importing this project it shows several errors. is there any installation manual? Please this is very urgent for my research.
对于16进制的字符串不应该直接转成10进制,这样会造成不一致
public static ResourceEntity readResValue(ByteBuffer buffer, StringPool stringPool) {
ResValue resValue = new ResValue();
resValue.setSize(Buffers.readUShort(buffer));
resValue.setRes0(Buffers.readUByte(buffer));
resValue.setDataType(Buffers.readUByte(buffer));
switch (resValue.getDataType()) {
case ResValue.ResType.INT_DEC:
case ResValue.ResType.INT_HEX:
resValue.setData(new ResourceEntity(buffer.getInt()));
建议对于16进制的数,还是先转换成16进制。
when i call the tool ,all other apks works fine,only this one throw exception:
net.dongliu.apk.parser.exception.ParserException: Unexpected chunk type:0
at net.dongliu.apk.parser.parser.BinaryXmlParser.readChunkHeader(BinaryXmlParser.java:321)
at net.dongliu.apk.parser.parser.BinaryXmlParser.parse(BinaryXmlParser.java:54)
at net.dongliu.apk.parser.AbstractApkParser.transBinaryXml(AbstractApkParser.java:164)
at net.dongliu.apk.parser.AbstractApkParser.parseManifestXml(AbstractApkParser.java:123)
at net.dongliu.apk.parser.AbstractApkParser.parseApkMeta(AbstractApkParser.java:105)
at net.dongliu.apk.parser.AbstractApkParser.getApkMeta(AbstractApkParser.java:56)
at yunnex.hop.web.controller.ApplicationController.apkUpload(ApplicationController.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:869)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:650)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)
at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:423)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1079)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:625)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
您好,我下载了1.7.3版本代码,发现有的应用图片没解析出来,跟踪了一下代码,看到了194行,在处理时代码如下:
case ResValue.ResType.STRING:
int strRef = buffer.getInt();
if (strRef > 0) {
resValue.data = new ResourceEntity(stringPool.get(strRef));
}
break;
请问,这个strRef 是不是应该包含0啊(strRef >= 0)?
Hi is this lib intended to work on Android? I am trying to parse a manifest xml, but the app fails at ParseUtils.readStringPool(). could I get Manifest Xml without reading stringpool?
is there a simple way to read the application attributes in simple means?
Currently I will be forced to use the getManifestXml()
method and use an xml parser to do this.
ApkParser apkParser = new ApkParser(apkFile);
apkParser.getIcon().getData()---returning null for any apk
Version 1.4.7 can not be found in public repositories, see e.g. http://mvnrepository.com/artifact/net.dongliu/apk-parser
When I give it the APK of the package "android", it crashed on this:
Caused by: java.lang.IllegalArgumentException: 18 is not a constant in net.dongliu.apk.parser.bean.Constants$ProtectionLevel
at java.lang.Enum.valueOf(Enum.java:198)
at net.dongliu.apk.parser.bean.Constants$ProtectionLevel.valueOf(Constants.java:146)
at net.dongliu.apk.parser.ApkParser.parsePermission(ApkParser.java:363)
at net.dongliu.apk.parser.ApkParser.parseApkMeta(ApkParser.java:208)
at net.dongliu.apk.parser.ApkParser.getApkMeta(ApkParser.java:104)
and indeed, I've tried debugging, and got a value of "18" for the protection level.
The weird thing is that I don't see it documented anywhere:
http://developer.android.com/guide/topics/manifest/permission-element.html
After some searching, I've found this:
http://stackoverflow.com/q/13515197/878126
Please fix this issue.
I think you need to make it a non-enum thing. It's more like an EnumSet .
The file to change is "Constants.java" , at "ProtectionLevel" class.
Also, BTW, it's more common to set enum values in uppercase...
Sorry for this, but I'm not a lawyer and English isn't my main language :
hmmm... me again...
apk-parser: 1.4.6
play: https://play.google.com/store/apps/details?id=com.wb.goog.edgeoftomorrow.ldr
direct link: https://dl.dropboxusercontent.com/u/1652957/com.wb.goog.edgeoftomorrow.ldr-1.0.3.apk
when: apkMeta = apkParser.getApkMeta();
java.lang.NumberFormatException: For input string: "orientation|screenLayout|screenSize"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at net.dongliu.apk.parser.parser.XmlTranslator.onAttribute(XmlTranslator.java:91)
at net.dongliu.apk.parser.parser.CompositeXmlStreamer.onAttribute(CompositeXmlStreamer.java:33)
at net.dongliu.apk.parser.parser.BinaryXmlParser.readXmlNodeStartTag(BinaryXmlParser.java:165)
at net.dongliu.apk.parser.parser.BinaryXmlParser.parse(BinaryXmlParser.java:88)
at net.dongliu.apk.parser.ApkParser.parseManifestXml(ApkParser.java:155)
at net.dongliu.apk.parser.ApkParser.getApkMeta(ApkParser.java:70)
The parser runs into a stack overflow error when parsing the attached apk file (Unzip the file to get the apk).
example.zip
Note that i trimmed down the apk to remove some of the assets so that the size is less than 10MB due to github size limit. The error is the same in the original apk and the modified apk.
aapt -> application-label:'Syberia'
apk-parser -t info -> label: @android:style/null
https://dl.dropboxusercontent.com/u/1652957/sample_applabel.apk
ResValue.ResType.INT_DEC
(and possibly ResValue.ResType.INT_HEX
) seem to be signed integers. For example, <intent-filter>
s priority attribute can be negative, and indeed I personally saw a negative value in Galaxy J's /system/app/Chrome.apk
.
Hey caoqianli , I am using Google App Engine Java at server end with Spring MVC too . You might be aware that GAE doesnot support java.io.FileOutputStream. When uploading a file(here apk file) Spring give a Multipart object which is org.springframework.web.multipart.MultipartFile class .Its very unfortunate that you ApkParser only takes File or String .Can you please make another constructer taking byte array of file .Thanks.
it fails to parse a apk that can be installed normally on phones and can be parsed by AAPT.
the following is the stack trace when parse fails:
Exception in thread "main" java.lang.NullPointerException
at net.dongliu.apk.parser.struct.xml.Attribute.toStringValue(Attribute.java:27)
at net.dongliu.apk.parser.parser.XmlTranslator.onAttribute(XmlTranslator.java:83)
at net.dongliu.apk.parser.parser.CompositeXmlStreamer.onAttribute(CompositeXmlStreamer.java:33)
at net.dongliu.apk.parser.parser.BinaryXmlParser.readXmlNodeStartTag(BinaryXmlParser.java:165)
at net.dongliu.apk.parser.parser.BinaryXmlParser.parse(BinaryXmlParser.java:88)
at net.dongliu.apk.parser.ApkParser.parseManifestXml(ApkParser.java:155)
at net.dongliu.apk.parser.ApkParser.getApkMeta(ApkParser.java:70)
please contact me if more detail is required.
您好,我在使用中发现一个疑问,麻烦帮忙解答一下:
ApkParser类的方法parseCertificate中,看代码是通过循环压缩包内文件来查找以.RSA或.DSA文件,如果apk包内没有找到这个文件的话,entry变量会保留最后一次的那个文件,是否在while语句块里的最后一句处理一下,设置 entry = null?
while (enu.hasMoreElements()) { entry = enu.nextElement(); if (entry.isDirectory()) { continue; } if (entry.getName().toUpperCase().endsWith(".RSA") || entry.getName().toUpperCase().endsWith(".DSA")) { break; } // 是否应该这么处理一下? entry = null; }
The parser is throwing the following exceptions:
net.dongliu.apk.parser.exception.ParserException: Unexpected chunk Type: 0x61a5
at net.dongliu.apk.parser.parser.ResourceTableParser.readChunkHeader(ResourceTableParser.java:222)
at net.dongliu.apk.parser.parser.ResourceTableParser.readPackage(ResourceTableParser.java:93)
at net.dongliu.apk.parser.parser.ResourceTableParser.parse(ResourceTableParser.java:60)
at net.dongliu.apk.parser.AbstractApkFile.parseResourceTable(AbstractApkFile.java:220)
at net.dongliu.apk.parser.AbstractApkFile.transBinaryXml(AbstractApkFile.java:157)
at net.dongliu.apk.parser.AbstractApkFile.parseManifestXml(AbstractApkFile.java:123)
at net.dongliu.apk.parser.AbstractApkFile.getManifestXml(AbstractApkFile.java:44)
I'm new to this library.
Is there any manual about how to use it in order to parse the manifest file, to see which intent filters the APK declares?
When parsing with version 2.2.0 the apk (66 Mb) that you can find here: https://ingestion-gate-bucket-dev.storage.orange.com/6f66ad04-da79-4573-b4fc-f0a98e307719, getIconFile().getPath() returns "false" and getIconFile().getData().length = 0. No way to get the icon.
try to parse Deer Hunter: https://play.google.com/store/apps/details?id=com.glu.deerhunt2
direct link: https://dl.dropboxusercontent.com/u/1652957/com.glu.deerhunt2-2440.apk
apkMeta = apkParser.getApkMeta();
java.io.EOFException: UnExpected EOF
at net.dongliu.apk.parser.io.TellableInputStream.readBytes(TellableInputStream.java:97)
at net.dongliu.apk.parser.io.TellableInputStream.skip(TellableInputStream.java:125)
at net.dongliu.apk.parser.parser.ResourceTableParser.readChunkHeader(ResourceTableParser.java:281)
at net.dongliu.apk.parser.parser.ResourceTableParser.readPackage(ResourceTableParser.java:79)
at net.dongliu.apk.parser.parser.ResourceTableParser.parse(ResourceTableParser.java:61)
at net.dongliu.apk.parser.ApkParser.parseResourceTable(ApkParser.java:322)
at net.dongliu.apk.parser.ApkParser.parseManifestXml(ApkParser.java:141)
at net.dongliu.apk.parser.ApkParser.getApkMeta(ApkParser.java:70)
This happens to me in some known APKs, such as Amazon and Tripit (attached).
When trying to parse the meta using ApkParser, apkParser.getApkMeta() fails with this error:
Exception in thread "main" java.lang.NumberFormatException: For input string: "0x20000"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:580)
at java.lang.Integer.valueOf(Integer.java:766)
at net.dongliu.apk.parser.struct.xml.Attributes.getInt(Attributes.java:40)
at net.dongliu.apk.parser.parser.ApkMetaTranslator.onStartTag(ApkMetaTranslator.java:56)
at net.dongliu.apk.parser.parser.CompositeXmlStreamer.onStartTag(CompositeXmlStreamer.java:19)
at net.dongliu.apk.parser.parser.BinaryXmlParser.readXmlNodeStartTag(BinaryXmlParser.java:189)
at net.dongliu.apk.parser.parser.BinaryXmlParser.parse(BinaryXmlParser.java:101)
at net.dongliu.apk.parser.AbstractApkParser.transBinaryXml(AbstractApkParser.java:164)
at net.dongliu.apk.parser.AbstractApkParser.parseManifestXml(AbstractApkParser.java:123)
at net.dongliu.apk.parser.AbstractApkParser.parseApkMeta(AbstractApkParser.java:105)
at net.dongliu.apk.parser.AbstractApkParser.getApkMeta(AbstractApkParser.java:56)
The problem is within ApkMetaTranslator:
Integer gl = attributes.getInt("glEsVersion");
But in this case glEsVersion is 0x20000.
I'm trying to get all the resources of an app..
the getResourceEntry method requires an $id argument...
I'm wondering what ID is this... is this the resource id or package id?
and how are we able to get the Resource ID list?
Can I recommend?
is it possible for you to add a getAllResourceEntries() method that we can use to fetch all resources under that specific type?
From version 2.0, apk-parser requires java8. The last version support java6 is 1.7.4.
According to the commit log, this should be java7 and 1.4.7?
apk-parser: 1.4.6
play : https://play.google.com/store/apps/details?id=com.sandisk.mz
direct link : https://dl.dropboxusercontent.com/u/1652957/com.sandisk.mz-2.1.0.apk
when : apkMeta = apkParser.getApkMeta();
java.lang.ClassCastException: net.dongliu.apk.parser.struct.StringPoolHeader cannot be cast to net.dongliu.apk.parser.struct.resource.PackageHeader
at net.dongliu.apk.parser.parser.ResourceTableParser.parse(ResourceTableParser.java:58)
at net.dongliu.apk.parser.ApkParser.parseResourceTable(ApkParser.java:323)
at net.dongliu.apk.parser.ApkParser.parseManifestXml(ApkParser.java:141)
at net.dongliu.apk.parser.ApkParser.getApkMeta(ApkParser.java:70)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.