Skip to content

Unable to compile shadowJar and other issues #3602

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
IgorEisberg opened this issue May 16, 2024 · 3 comments · Fixed by #3604
Closed

Unable to compile shadowJar and other issues #3602

IgorEisberg opened this issue May 16, 2024 · 3 comments · Fixed by #3604
Milestone

Comments

@IgorEisberg
Copy link
Contributor

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.

@iBotPeaches
Copy link
Owner

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

@iBotPeaches
Copy link
Owner

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

@iBotPeaches
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants