howardpang / androidNativeBundle

a gradle plugin that support publish c/c++ headers to 'aar' and depend those 'aar'
Apache License 2.0
71 stars 14 forks source link

AGP 7.4 not supported #18

Closed liedQM closed 1 year ago

liedQM commented 1 year ago

With AGP 7.4 the internal API of the LibraryVariant has changed and therefor you receive the following error:

> No such property: variantDependencies for class: com.android.build.gradle.internal.variant.LibraryVariantData

I've already found a solution but I'm unable to push a branch and therefor I'll describe the fix here:

Add the following lines to GradleApiAdapter. getArtifactCollection(..):

        if (isAndroidGradleVersionGreaterOrEqualTo("7.4.0"))  {
            artifactCollection = variant.component.getVariantDependencies().getArtifactCollection(type, scope, artifactType)
        } else if (isAndroidGradleVersionGreaterOrEqualTo("4.1.0")) {

and it will work with AGP 7.4

howardpang commented 1 year ago

Thanks for your work, I will update the plugin later.

howardpang commented 1 year ago

Try 1.1.3