Skip to content
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

Fixed AGP 8.3.0 breaking change #154

Closed
wants to merge 1 commit into from
Closed

Fixed AGP 8.3.0 breaking change #154

wants to merge 1 commit into from

Conversation

gmazzo
Copy link
Contributor

@gmazzo gmazzo commented Mar 14, 2024

What has changed

Addresses #153 with a minimal set of changes to unblock the consumers of this plugin.

The breaking change is produced because the plugin is accessing an internal AGP API for getting the Android SDK location.

As suggested by @SimonMarquis, this can be done with a public API in BaseExtension.sdkDirectory . I made minimal changes to read from there, falling back to an ANDROID_HOME environment variable if not provided to keep the coupling at the bare minimum.

Additionally, I've moved the whole ANDROID_GRADLE_PLUGIN dependency as a compileOnly to avoid leaking it to the consumers

Why was it changed

Because since AGP 8.3.0, the internal API signature has changed, and it breaks: #153

Related issues

AGP 8.3.0 fails with NoSuchMethodError #153

Note

This project is a bit outdated on its dependencies:
A bump to 8.3.0 was not possible without also bumping Gradle to at least 8.4, and doing so introduced a new problem with accessing a removed API

> An exception occurred applying plugin request [id: 'com.guardsquare.proguard']
> Failed to apply plugin 'com.guardsquare.proguard'.
   > API 'android.registerTransform' is removed.

@nathan3d
Copy link
Collaborator

Can you update the Gradle version(s) in checks matrix so the tests can pass?

@gmazzo
Copy link
Contributor Author

gmazzo commented Mar 19, 2024

Can you update the Gradle version(s) in the checks matrix so the tests can pass?

Can you provide better actionable feedback? Which versions of Gradle should we be targeting?

I've checked locally, and main seems to be currently broken. Running ./gradlew check -s from a fresh checkout prints:

java.lang.StackOverflowError
        at java.base/java.util.TreeSet.iterator(TreeSet.java:181)
        at org.gradle.execution.plan.FinalizerGroup.isCanCancel(FinalizerGroup.java:153)
        at org.gradle.execution.plan.CompositeNodeGroup.isCanCancel(CompositeNodeGroup.java:101)
        at org.gradle.execution.plan.Node.isCanCancel(Node.java:232)
        at org.gradle.execution.plan.FinalizerGroup.isCanCancel(FinalizerGroup.java:155)
        at org.gradle.execution.plan.CompositeNodeGroup.isCanCancel(CompositeNodeGroup.java:101)
        at org.gradle.execution.plan.Node.isCanCancel(Node.java:232)

It seems my changes didn't introduce this issue, but rather this project needs more active contributions. Is it even maintained?

Fixing the whole build should be addressed in a separate PR, not in this one.

@nathan3d
Copy link
Collaborator

Can you update the Gradle version(s) in the checks matrix so the tests can pass?

Can you provide better actionable feedback? Which versions of Gradle should we be targeting?

I've checked locally, and main seems to be currently broken. Running ./gradlew check -s from a fresh checkout prints:

java.lang.StackOverflowError
        at java.base/java.util.TreeSet.iterator(TreeSet.java:181)
        at org.gradle.execution.plan.FinalizerGroup.isCanCancel(FinalizerGroup.java:153)
        at org.gradle.execution.plan.CompositeNodeGroup.isCanCancel(CompositeNodeGroup.java:101)
        at org.gradle.execution.plan.Node.isCanCancel(Node.java:232)
        at org.gradle.execution.plan.FinalizerGroup.isCanCancel(FinalizerGroup.java:155)
        at org.gradle.execution.plan.CompositeNodeGroup.isCanCancel(CompositeNodeGroup.java:101)
        at org.gradle.execution.plan.Node.isCanCancel(Node.java:232)

It seems my changes didn't introduce this issue, but rather this project needs more active contributions. Is it even maintained?

Fixing the whole build should be addressed in a separate PR, not in this one.

I thought it was broken with your update, but seems to just be broken in general. I'll see if I can get it fixed.

@gmazzo
Copy link
Contributor Author

gmazzo commented Mar 20, 2024

I thought it was broken with your update, but seems to just be broken in general. I'll see if I can get it fixed.

Actually, I have it fixed locally already.

The main offender is the com.guardsquare.proguard plugin, which it seems discontinued (up to AGP 7.x) and redundant, as AGP always had it embedded and later replaced with R8.

After removing it, and therefore the sample/proguard project I was able to fix the build, and even bump both Gradle and AGP versions to the latest.

I just submitted #158 fixing the build

@gmazzo
Copy link
Contributor Author

gmazzo commented Mar 20, 2024

Closing in favor of #159

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 this pull request may close these issues.

2 participants