iBotPeaches / Apktool

A tool for reverse engineering Android apk files

Home Page:https://apktool.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to compile shadowJar and other issues

IgorEisberg opened this issue · comments

Not sure what change caused this breakage, but here it goes.
Command: ./gradlew build shadowJar proguard release
Fails with error:

> Configure project :
Building RELEASE (master): 2.10.0-xiaomi.eu

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':release'.
> Task with path 'proguard' not found in root project 'apktool-cli'.

When commenting out this line in brut.apktool\apktool-cli\build.gradle.kts:

tasks.getByPath(":release").dependsOn("proguard")

Then the JAR compiles fine, but when trying to use it, none of the XML files can be decompiled and ends with an error:

org.xmlpull.v1.XmlPullParserException: caused by: org.xmlpull.v1.XmlPullParserException: resource not found: /META-INF/services/org.xmlpull.v1.XmlPullParserFactory make sure that parser implementing XmlPull API is available
        at org.xmlpull.v1.XmlPullParserFactory.newInstance(SourceFile)
        ... 4 more

When manually adding META-INF/services/org.xmlpull.v1.XmlPullParserFactory extracted from a previous Apktool JAR to the build JAR, all works fine.

Also, when building without "release", the output is apktool-v2.9.2-48-6b986e9a-SNAPSHOT.jar, not 2.10.0.

Quite a whole lot of mess.

Yeah R8 is having some issues and stripping way more than it should - blocker for 2.10.x at the moment.

Broke here for context, but I'm not reverting to force myself to fix it before a release - e69ecb5

Another thing I committed to Google's smali repo. Dudes used incompatible DEX version for Android 10...
google/smali#55

I dug into this - it appears the old old xmlpull library is violating spec for loaders, so R8 is stripping it out.

Warning in /home/ibotpeaches/Desktop/Projects/Java/Apktool/brut.apktool/apktool-cli/build/libs/apktool-cli.jar:META-INF/services/org.xmlpull.v1.XmlPullParserFactory:
Unexpected reference to missing service implementation class in META-INF/services/org.xmlpull.v1.XmlPullParserFactory: org.xmlpull.mxp1.MXParser,org.xmlpull.mxp1_serializer.MXSerializer.

So two classes comma delimited, but spec says it must be newline delimited. I was hoping I could just upgrade this package, but its been dead for a decade.

A service provider identifies itself by placing a provider-configuration file in the resource directory META-INF/services. The file's name should consist of the fully-qualified name of the abstract service class. The file should contain a newline-separated list of unique concrete provider-class names. Space and tab characters, as well as blank lines, are ignored. The comment character is '#' (0x23); on each line all characters following the first comment character are ignored. The file must be encoded in UTF-8.

https://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#Service%20Provider