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

Issue related with flavorDimensions #15

Closed IlyaPavlik closed 2 years ago

IlyaPavlik commented 3 years ago

If the project has several flavorDimensions the project won't be built.

Example:

apply plugin: 'com.ydq.android.gradle.native-aar.import'

flavorDimensions 'type1', 'type2'

productFlavors {
    flavor1 {
        dimension 'type1'
    }
    flavor2 {
        dimension 'type1'
    }
    flavor3 {
        dimension 'type2'
    }
    flavor4 {
        dimension 'type2'
    }
}

Cause of the issue might be combined flavor names and this name is used for finding product flavor for a variable (gradleMk).

https://github.com/howardpang/androidNativeBundle/blob/f8c2fcf68ed6db8b32bd018342df7061ee059606/buildSrc/src/main/groovy/com/yy/android/gradle/nativedepend/NativeBundleImportPlugin.groovy#L110

howardpang commented 3 years ago

What's your environment

IlyaPavlik commented 3 years ago

Gradle 7.2 (plugin: 7.0.2) SDK compile: 30

howardpang commented 3 years ago

Sorry, the plugin is not support gradle 7.2 currently and new version is coming soon

champistalking commented 3 years ago

Sorry, the plugin is not support gradle 7.2 currently and new version is coming soon

looking forward to it

howardpang commented 3 years ago

Please try 1.1.0

IlyaPavlik commented 2 years ago

Unfortunatelly the new version doesn't work for me. Build failed:

java.lang.NullPointerException: Cannot get property 'configurationModel' on null object
Caused by: java.lang.NullPointerException: Cannot get property 'configurationModel' on null object
    at com.yy.android.gradle.nativedepend.GradleApiAdapter.addArgumentToNativeBuildOption(GradleApiAdapter.groovy:98)
    at com.yy.android.gradle.nativedepend.GradleApiAdapter$addArgumentToNativeBuildOption.call(Unknown Source)
    at com.yy.android.gradle.nativedepend.NativeBundleImportPlugin$_apply_closure1.doCall(NativeBundleImportPlugin.groovy:79)
howardpang commented 2 years ago

What's your environment

IlyaPavlik commented 2 years ago

I've updated the gradle plugin, so now it's 7.0.3, but with 7.0.2 the issue with 'configurationModel' is still reproducable.

howardpang commented 2 years ago

My demo is OK(https://github.com/howardpang/nativeBundleDemo); Can you show your build.gradle.

IlyaPavlik commented 2 years ago

Thanks for demo. I've reproduced the issue with your demo.

To reproduce the issue you need use only 'com.ydq.android.gradle.native-aar.import' And remove/comment externalNativeBuild block in each flavor

Example: build.txt

In my project I implemented externalNativeBuild in defaultConfig block

howardpang commented 2 years ago

Thanks, i have reproduced the issue, and will resolve it later

howardpang commented 2 years ago

Try 1.1.1

IlyaPavlik commented 2 years ago

It works now, thank you!