[Magisk] Deleted member 3586283:
Hello,

I'm currently trying to run apktool using dalvikvm in the customize.sh script:

apktool_d() {
#ANDROID_DATA=$TMPDIR_JCD ANDROID_ROOT=/system LD_LIBRARY_PATH=/system/lib dalvikvm -Xbootclasspath:/system/framework/core.jar:/system/framework/conscrypt.jar:/system/framework/apache-xml.jar -classpath $BIN/apktool_*-dexed.jar brut.apktool.Main d --frame-path $TMPDIR_JCD/framework --no-src -o $TMPDIR_JCD/resout $1
dalvikvm -classpath $BIN/apktool_*-dexed.jar brut.apktool.Main d --no-src -o $TMPDIR_JCD/resout $1
test $? != 0 && abort "Decoding APK resources failed. Aborting..."
}

I've tried to port that code from an outdated template: https://github.com/djb77/magisk-module-template-apkpatcher

When using the commented out method the command aborts with "Decoding APK resources failed" and logcat *:E is telling me the following:

04-17 21:11:53.649 11641 11641 E dalvikvm: Could not create image space with image file '/system/framework/boot.art'. Attempting to fall back to imageless running. Error was: Unexpected component count in /system/framework/arm/boot.art, received 11, expected non-zero and <= 3
04-17 21:11:53.677 11641 11641 E dalvikvm: Could not initialize without image: Boot classpath is empty.

When trying the second approach without -Xbootclasspath and so on I'm getting a NullPointerException directly in the magisk log (saved file):

I: Using Apktool 2.3.4 on Bluetooth.apk
I: Loading resource table...
I: Decoding AndroidManifest.xml with resources...
Exception in thread "main" java.lang.ExceptionInInitializerError
at brut.util.OSDetection.isMacOSX(OSDetection.java:28)
at brut.androlib.res.AndrolibResources.getFrameworkDir(AndrolibResources.java:913)
at brut.androlib.res.AndrolibResources.getFrameworkApk(AndrolibResources.java:754)
at brut.androlib.res.AndrolibResources.loadFrameworkPkg(AndrolibResources.java:116)
at brut.androlib.res.data.ResTable.getPackage(ResTable.java:84)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:67)
at brut.androlib.res.data.ResTable.getResSpec(ResTable.java:63)
at brut.androlib.res.decoder.ResAttrDecoder.decode(ResAttrDecoder.java:39)
at brut.androlib.res.decoder.AXmlResourceParser.getAttributeValue(AXmlResourceParser.java:385)
at org.xmlpull.v1.wrapper.classic.XmlPullParserDelegate.getAttributeValue(XmlPullParserDelegate.java:69)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.parseManifest(XmlPullStreamDecoder.java:97)
at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:65)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:141)
at brut.androlib.res.decoder.XmlPullStreamDecoder.decodeManifest(XmlPullStreamDecoder.java:153)
at brut.androlib.res.decoder.ResFileDecoder.decodeManifest(ResFileDecoder.java:155)
at brut.androlib.res.AndrolibResources.decodeManifestWithResources(AndrolibResources.java:204)
at brut.androlib.Androlib.decodeManifestWithResources(Androlib.java:136)
at brut.androlib.ApkDecoder.decode(ApkDecoder.java:122)
at brut.apktool.Main.cmdDecode(Main.java:164)
at brut.apktool.Main.main(Main.java:73)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.lang.String.toLowerCase()' on a null object reference
at brut.util.OSDetection.<clinit>(OSDetection.java:21)
... 20 more
Decoding APK resources failed. Aborting...
! Installation failed

After some research I tried to find out if the customize.sh is running as root because some posts telling that setting LD_LIBRARY_PATH setting as root fixed those "Could not create image space" dalvikvm errors but can't find any info about that. see https://github.com/termux/termux-packages/issues/900#issuecomment-322207233

I'm out of ideas and happy for any help.

Thanks in advance

Danny.