tommybuonomo / dotsindicator

Three material Dots Indicators for view pagers in Android !
Apache License 2.0
3.41k stars 350 forks source link

Error related to build variants #158

Closed ederdoski closed 1 year ago

ederdoski commented 1 year ago

Hello !! i update the library from 4.1.2 to 4.3 but i the project doent recognize the library i was investiganting the problem and i can see is asociated to the build variants for reason uknown.

when the project is compiled in "debug" or "release" the library is reconigze but in other variants not, i found this error in de build log :

No matching variant of com.tbuonomo:dotsindicator:4.3 was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'develop', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - Variant 'debugVariantMavenApiPublication' capability com.tbuonomo:dotsindicator:4.3 declares an API of a component:
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'develop'

i appreciate your help

sanjaybd2690 commented 1 year ago

same issue...any solution?

Hessam-Emami commented 1 year ago

Same issue here.

Dixzz commented 1 year ago

For the time being you can include it as project level library.

Add this to your build.gradle (app level) implementation files('libs/dotsindicator-4.3-release.aar')

And make sure dotsindicator-4.3-release.aar is inside project/app/libs/dotsindicator-4.3-release.aar You can download lib from maven central - 4.3 aar For more version info checkout - Maven Central Repo

Ankluas commented 1 year ago

We have the same issue with the new version 4.3

Helton57 commented 1 year ago

Try this solution:

Use matchingFallbacks to specify alternative matches for a given build type

Your app includes a build type that a library dependency does not.


It works for me

azamatdev commented 1 year ago

Thanks @Helton57, I looked through doc. In my case, i added staging build type, as the lib does not have such build type, we should give alternative build types like below. staging { .... matchingFallbacks = ['debug', 'qa', 'release'] }

Now it worked without a problem!

tommybuonomo commented 1 year ago

When adding a different buildType than debug or release, please add the matchingFallbacks parameter to your custom buildType (reference)

Groovy

// In the app's build.gradle file.
android {
    buildTypes {
        debug {}
        release {}
        staging {
            // Specifies a sorted list of fallback build types that the
            // plugin can try to use when a dependency does not include a
            // "staging" build type. You may specify as many fallbacks as you
            // like, and the plugin selects the first build type that's
            // available in the dependency.
            matchingFallbacks = ['debug', 'qa', 'release']
        }
    }
}

Kotlin

// In the app's build.gradle.kts file.
android {
    buildTypes {
        getByName("debug") {}
        getByName("release") {}
        create("staging") {
            // Specifies a sorted list of fallback build types that the
            // plugin can try to use when a dependency does not include a
            // "staging" build type. You may specify as many fallbacks as you
            // like, and the plugin selects the first build type that's
            // available in the dependency.
            matchingFallbacks += listOf("debug", "release")
        }
    }
}