Apktool: Error with animated vector drawble

Created on 25 Mar 2017  路  5Comments  路  Source: iBotPeaches/Apktool

Information

  1. Apktool Version (apktool -version) - 2.2.2
  2. Operating System (Mac, Linux, Windows) - Windows 10
  3. APK From? (Playstore, ROM, Other) - Sony Nougat 7.1.1

Stacktrace/Logcat

Log For : SystemUI.apk

Log Type : Decompiling

Log Recorded At : 25-03-17 -- 8:23:57,38

Log Recorded By : Advanced ApkTool v4.1.0 By BDFreak


Exception in thread "main" java.lang.IllegalStateException: duplicated prefix 'android'
    at org.xmlpull.mxp1_serializer.MXSerializer.setPrefix(MXSerializer.java:438)
    at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.setPrefix(StaticXmlSerializerWrapper.java:132)
    at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.writeStartTag(StaticXmlSerializerWrapper.java:261)
    at org.xmlpull.v1.wrapper.classic.StaticXmlSerializerWrapper.event(StaticXmlSerializerWrapper.java:211)
    at brut.androlib.res.decoder.XmlPullStreamDecoder$1.event(XmlPullStreamDecoder.java:83)
    at brut.androlib.res.decoder.XmlPullStreamDecoder.decode(XmlPullStreamDecoder.java:141)
    at brut.androlib.res.decoder.ResStreamDecoderContainer.decode(ResStreamDecoderContainer.java:33)
    at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:120)
    at brut.androlib.res.decoder.ResFileDecoder.decode(ResFileDecoder.java:105)
    at brut.androlib.res.AndrolibResources.decode(AndrolibResources.java:262)
    at brut.androlib.Androlib.decodeResourcesFull(Androlib.java:132)
    at brut.androlib.ApkDecoder.decode(ApkDecoder.java:108)
    at brut.apktool.Main.cmdDecode(Main.java:166)
    at brut.apktool.Main.main(Main.java:81)

Steps to Reproduce

  1. apktool try to decompile

Frameworks and APK

https://www.mediafire.com/folder/7aljm05235z0x4r,4f1nabl6an5pfhn/shared

Questions to ask before submission

  1. Have you tried apktool d, apktool b without changing anything? not related
  2. If you are trying to install a modified apk, did you resign it? not related
  3. Are you using the latest apktool version? yes

More informations

We aren't able to decompile the apk. Issue is inside res/drawable folder, if you remove all files somc_sony_clock_2_anim_vector_drawable_xxx.xml, you're able to decompile.

Thanks

Bug

Most helpful comment

Confirmed.

All 5 comments

Confirmed.

Looking into this. This problem has nothing to do with animated drawables. It has two similar namespaces which are clashing.

N: android=http://schemas.android.com/apk/res/android
  N: androidprv=http://schemas.android.com/apk/prv/res/android

EDIT: Which are inside the animated vector drawables lol

N: android=http://schemas.android.com/apk/res/android
  N: aapt=http://schemas.android.com/aapt
    N: android=http://schemas.android.com/apk/res/android
      E: vector (line=11)
        A: android:height(0x01010155)=@0x7f100313
        A: android:width(0x01010159)=@0x7f100312
        A: android:viewportWidth(0x01010402)=(type 0x4)0x42a40000
        A: android:viewportHeight(0x01010403)=(type 0x4)0x42f40000
        E: path (line=16)
          A: android:name(0x01010003)="sony_clock_2_hour_digit" (Raw: "sony_clock_2_hour_digit")
          A: android:pathData(0x01010405)="M8.91,7.76H71.63V8.49s-18,25.69-30.29,65.15c-4,12.71-9.37,35.73-9.37,42" (Raw: "M8.91,7.76H71.63V8.49s-18,25.69-30.29,65.15c-4,12.71-9.37,35.73-9.37,42")
          A: android:strokeColor(0x01010406)=@0x7f0c00db
          A: android:strokeWidth(0x01010407)=(type 0x4)0x408570a4
          A: android:trimPathStart(0x01010408)=(type 0x4)0x0
          A: android:trimPathEnd(0x01010409)=(type 0x4)0x3f800000
          A: android:trimPathOffset(0x0101040a)=(type 0x4)0x0
          A: android:strokeMiterLimit(0x0101040d)=(type 0x4)0x41200000
        E: group (line=26)
          A: android:name(0x01010003)="sony_clock_2_hour_dot" (Raw: "sony_clock_2_hour_dot")
          E: path (line=28)
            A: android:fillColor(0x01010404)=@0x7f0c00db
            A: android:pathData(0x01010405)="M 0 -5 C 2.76142374915 -5 5 -2.76142374915 5 0 C 5 2.76142374915 2.76142374915 5 0 5 C -2.76142374915 5 -5 2.76142374915 -5 0 C -5 -2.76142374915 -2.76142374915 -5 0 -5 Z" (Raw: "M 0 -5 C 2.76142374915 -5 5 -2.76142374915 5 0 C 5 2.76142374915 2.76142374915 5 0 5 C -2.76142374915 5 -5 2.76142374915 -5 0 C -5 -2.76142374915 -2.76142374915 -5 0 -5 Z")

Hmmm. What to do about this. Maybe decoding Vectors back to source isn't needed.

Okay, found problem. This bug was actually introduced way back when we moved from Maven to Gradle. This is known I think as the Maven dependency hell, so thank you for discovering it unintentionally.

We have a file at apktool-lib/src/main/java/org/xmlpull/mxp1_serializer/MXSerializer.java that we use to get around some limitations that regular XML files have. This file isn't actually being used at all, because the package xpp3:xpp3:1.1.4c is loading its own copy of that file. This means any modification to that file would never be used by apktool as the dependency version of the file would win. This could be classified as a classpath, dependency issue.

Found out my library for building a fatJar is deprecated and abandoned. There are new plugins for building uber/fat jars with a lot of features that may be good to switch to, in order to patch this.

Was this page helpful?
0 / 5 - 0 ratings