apktool -version) - v2.4.1 > apktool d /tmp/crash.apk
I: Using Apktool 2.4.1 on crash.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/edu/.local/share/apktool/framework/1.apk
Exception in thread "main" java.lang.NullPointerException
at java.base/java.io.Writer.write(Writer.java:249)
at org.xmlpull.renamed.MXSerializer.attribute(MXSerializer.java:631)
at org.xmlpull.v1.wrapper.classic.XmlSerializerDelegate.attribute(XmlSerializerDelegate.java:106)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:267)
at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:84)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:142)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:154)
at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:162)
at brut.androlib.res.AndrolibResources.decodeManifestWithResources(AndrolibResources.java:204)
at brut.androlib.Androlib.decodeManifestWithResources(Androlib.java:134)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:122)
at brut.apktool.Main.cmdDecode(Main.java:170)
at brut.apktool.Main.main(Main.java:76)
Include stacktrace here
https://play.google.com/store/apps/details?id=com.nhnpixelcube.fishislandII&hl=en
Another one:
[15:44 edu@xps tmp] > (master) apkinfo /home/edu/apks/skyuk/com.bt.btsport.apk
APK: /home/edu/apks/skyuk/com.bt.btsport.apk
App name: BT Sport
Package: com.bt.btsport
Version name: 5.17.0
Version code: 5170018
[15:44 edu@xps tmp > (master) apktool d -f --no-src -o /tmp/ /home/edu/apks/skyuk/com.bt.btsport.apk
Exception in thread "main" java.lang.NullPointerException
at brut.util.OS.rmdir(OS.java:41)
at brut.util.OS.rmdir(OS.java:44)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:95)
at brut.apktool.Main.cmdDecode(Main.java:170)
at brut.apktool.Main.main(Main.java:76)
I replicated this. Marking as bug.
Same problem, downgrading to 2.4.0 mitigated the issue.
I could identify this commit as the one for which the problem first appeared. Apparently, the Manifest of this particular apk contains an attribute android:manageSpace, which causes this problem.
I also played around with a potential fix for this, something like changing the else branch in AXMLResourceParser.getAttributeName() to this:
try {
int resource_id = getAttributeNameResource(index);
if (resource_id != 0) {
value = mAttrDecoder.decodeManifestAttr(resource_id);
}
} catch (AndrolibException e) {
}
return value;
Since the attribute appears to be in the android namespace, but doesn't have a corresponding resource ID...
This works well for decoding this APK, but when I try to rebuild it I get another error related to that attribute: error: No resource identifier found for attribute 'manageSpace' in package 'android'
Which makes sense, I guess. Unfortunately, I don't understand the resources-code/-parsing well enough to know what the correct solution would be in this case. Any ideas @iBotPeaches?
Any chance this is going to be fixed in v2.5.0, @iBotPeaches?
Any chance this is going to be fixed in v2.5.0, @iBotPeaches?
Not sure. Getting Android 11 support is highest priority and that is not working yet
Same problem, downgrading to 2.4.0 mitigated the issue.
Thanks! Downgrading to 2.4.0 solved the same issue for me too!!
@iBotPeaches
Any chance this is going to be fixed in v2.5.0, @iBotPeaches?
Downgrading to 2.4.0 can mitigate the issue.
Any chance this is going to be fixed in v2.5.0, @iBotPeaches?
Not sure. Getting Android 11 support is highest priority and that is not working yet
Okay, understood. Unfortunately, I can't downgrade so I was hoping there'd be more news.
Getting the same problem with this APK https://play.google.com/store/apps/details?id=com.nhnent.SKQUEST
Downgraded to 2.3.4 which is the best one (2.4.0 have exit code -1073741515 error), it worked fine
I took another look at this. I'm not convinced v2.4.0 has anything better here outside of not crashing on disassemble. We have an attribute that Android (in my research) has no idea about - manageSpace.
It has no resourceId as shown below.
E: application (line=83)
A: android:theme(0x01010000)=@0x7f0a002b
A: android:label(0x01010001)=@0x7f080045
A: android:icon(0x01010002)=@0x7f030000
A: android:name(0x01010003)="android.support.v4.soft.ApplicationMain" (Raw: "android.support.v4.soft.ApplicationMain")
A: android:allowBackup(0x01010280)=(type 0x12)0xffffffff
A: android:supportsRtl(0x010103af)=(type 0x12)0xffffffff
A: android:isGame(0x010103f4)=(type 0x12)0xffffffff
A: android:networkSecurityConfig(0x01010527)=@0x7f060000
A: android:manageSpace="true" (Raw: "true")
E: activity (line=91)
So v2.4.0 decodes without crash. v2.4.1 crashes because it is trying to resolve a resourceId (0) that does not exist. No matter which path you take. You'll end up with a resource in the manifest that during build won't work.
Getting
W: /home/ibotpeaches/Downloads/Apktool/2300/com.nhnpixelcube.fishislandII_30104_apps.evozi.com/AndroidManifest.xml:39: error: No resource identifier found for attribute 'manageSpace' in package 'android'
I checked all of AOSP for this property - no go. https://github.com/search?q=org%3Aaosp-mirror+manageSpace
This makes me think its an alternative resource since I've grepped my entire drive of collected Apktool resources and AOSP itself. No hits.
What is this resource? Should Apktool drop unknown resources in the manifest?
Obviously a crash on disassemble is not preferred so we can fix that, but I don't see fixing the real problem at hand here.
The crash fix on decode (WIP) - https://github.com/iBotPeaches/Apktool/pull/2437 - while I investigate more about a missing resourceId for a manifest resource.
Apktool is not the business of stripping things from an application to allow rebuild. So for now, no change will be made there. The crash fix will be merged shortly.
a% ➜ 1576 apktool d com.spacosa.android.famy.global.apk -f
I: Using Apktool 2.4.2-f545c2-SNAPSHOT on com.spacosa.android.famy.global.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
➜ 1576 apktool b com.spacosa.android.famy.global
I: Using Apktool 2.4.2-f545c2-SNAPSHOT
I: Checking whether sources has changed...
I: Smaling smali folder into classes.dex...
I: Checking whether resources has changed...
I: Building resources...
W: warning: string 'title_famy_profile_update' has no default translation.
W: warning: string 'title_famy_version_name' has no default translation.
I: Copying libs... (/lib)
I: Building apk file...
I: Copying unknown files/dir...
I: Built apk...
➜ 1576
&
➜ 2300 apktool d com.nhnpixelcube.fishislandII_30104_apps.evozi.com.apk -f
I: Using Apktool 2.4.2-f545c2-SNAPSHOT on com.nhnpixelcube.fishislandII_30104_apps.evozi.com.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
I: Loading resource table from file: /home/ibotpeaches/.local/share/apktool/framework/1.apk
I: Regular manifest package...
I: Decoding file-resources...
I: Decoding values */* XMLs...
I: Baksmaling classes.dex...
I: Baksmaling classes2.dex...
I: Baksmaling classes3.dex...
I: Copying assets and libs...
I: Copying unknown files...
I: Copying original files...
I: Copying META-INF/services directory
➜ 2300
Will be in next release.
apktool d -f --no-src -o /tmp/ /home/edu/apks/skyuk/com.bt.btsport.apk
FYI only, apktool 2.5.0 has this bug yet
Nice, it works now on 2.5.0
Btw, about android:manageSpace="true", it was a thing since 2018 and another apps have it too, I just simply remove it from androidmanifest.xml and it let me compile. The app is been worked fine so far
Most helpful comment
&
Will be in next release.