tommybuonomo / dotsindicator

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

Versions 4.3 and 5.0 don't work with custom build types, but version 4.2 did! #178

Open fulcrum6378 opened 1 year ago

fulcrum6378 commented 1 year ago

First of all, thank you for developing such a useful utility. I've been using it for a year.

Because of some app signing reasons I had to make a very simple custom build type: "debuggee" instead of "debug". Like this:

    defaultConfig {
        ...
        signingConfig signingConfigs.main
    }
    buildTypes {
        debuggee {
            debuggable true
            minifyEnabled false
        }
        release {
            ...
        }
    }

At first I used the version 4.2 and everything was fine. But when you released the versions 4.3 and even 5.0 and I upgraded, I always encountered a weird error in the assembleDebugee Gradle process (not the initial build). It's been months since I encounter this error, therefore I downgraded it to 4.2 and suppressed the upgrade warning using "//noinspection GradleDependency".

Summary:

Execution failed for task ':app:dataBindingMergeDependencyArtifactsDebuggee'.
> Could not resolve all files for configuration ':app:debuggeeCompileClasspath'.
   > Could not resolve com.tbuonomo:dotsindicator:5.0.
     Required by:
         project :app
      > No matching variant of com.tbuonomo:dotsindicator:5.0 was found. The consumer was configured to find a component for use during compile-time, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debuggee', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '8.0.2', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - Variant 'debugVariantMavenApiPublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during compile-time:
              - 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 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'debugVariantMavenJavaDocPublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - 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 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'debugVariantMavenRuntimePublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - 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 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'debugVariantMavenSourcePublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - 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 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'releaseVariantMavenApiPublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during compile-time:
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'releaseVariantMavenJavaDocPublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'releaseVariantMavenRuntimePublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')
          - Variant 'releaseVariantMavenSourcePublication' capability com.tbuonomo:dotsindicator:5.0 declares a component for use during runtime:
              - Incompatible because this component declares a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'release' and the consumer needed a component, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debuggee'
              - Other compatible attributes:
                  - Doesn't say anything about com.android.build.api.attributes.AgpVersionAttr (required '8.0.2')
                  - Doesn't say anything about its target Java environment (preferred optimized for Android)
                  - Doesn't say anything about org.jetbrains.kotlin.platform.type (required 'androidJvm')

Here's a complete log of the assembleDebuggee Gradle process: build log.txt


There is also a weird warning every time I switch between build types, no matter it is release, debug or debuggee: warning.txt

Thank you again.

f0rev commented 1 year ago

Same here...

fulcrum6378 commented 1 year ago

Oh I didn't see this issue before: https://github.com/tommybuonomo/dotsindicator/issues/170

At least I know when this happened, which is when the project version went from 4.2 to 4.3.

I compared the related commits to v4.2 and v4.3 releases and the only Gradle-related changes that had been done were 2 things:

  1. Gradle config files were migrated from Groovy to Kotlin DSL (which don't seem to have caused this problem)
  2. AGP version 4.1.3 was upgraded to 7.1.3 and "gradle-6.6-all.zip" to "gradle-7.4.2-bin.zip".

Here's another guy in StackOverflow with the same situation (the 2nd one above) and the same problem: https://stackoverflow.com/questions/64758477/android-buildtypes-vs-productflavors-error The guy had upgraded from AGP 3.5.x to 4.10 (and to Gradle 6.5). So it seems that it would throw the same error on a custom build flavor too!!

Using this guide, I found a solution for the module which implements a custom build variant: https://developer.android.com/build/build-variants#resolve_matching_errors

    buildTypes {
        create("debuggee") {
            ...
            matchingFallbacks += listOf("debug")
        }
    }
    buildTypes {
        debuggee {
            ...
            matchingFallbacks = ['debug']
        }
    }

But is there a solution for the library NOT TO REQUIRE ALL THESE EFFORTS, just like the other libraries?