Skip to content

runningcode/BuildConfigIssue

Repository files navigation

BuildConfig issue

To reproduce run ./gradlew :buildconfig-lib:publishToMavenLocal

The build fails with the following error:

A problem was found with the configuration of task ':buildconfig-lib:sourceReleaseJar' (type 'SourceJarTask').
  - Gradle detected a problem with the following location: '/Users/nelsonosacky/AndroidStudioProjects/BuildConfigIssue/buildconfig-lib/build/generated/sources/buildConfig/main'.

    Reason: Task ':buildconfig-lib:sourceReleaseJar' uses this output of task ':buildconfig-lib:generateNonAndroidBuildConfig' without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed.

    Possible solutions:
      1. Declare task ':buildconfig-lib:generateNonAndroidBuildConfig' as an input of ':buildconfig-lib:sourceReleaseJar'.
      2. Declare an explicit dependency on ':buildconfig-lib:generateNonAndroidBuildConfig' from ':buildconfig-lib:sourceReleaseJar' using Task#dependsOn.
      3. Declare an explicit dependency on ':buildconfig-lib:generateNonAndroidBuildConfig' from ':buildconfig-lib:sourceReleaseJar' using Task#mustRunAfter.

    For more information, please refer to https://docs.gradle.org/8.11.1/userguide/validation_problems.html#implicit_dependency in the Gradle documentation.

This happens when following the publishing instructions here https://developer.android.com/build/publish-library/configure-pub-variants and here: https://developer.android.com/build/publish-library/upload-library

Notably, the following line to configure the sources jar causes the issue in combination with the BuildConfig library.

publishing {
  singleVariant("release") {
    withSourcesJar()
    withJavadocJar()
  }
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages