Skip to content

Could not create task ':mylib:copyDebugJniLibsProjectAndLocalJars #28

@amorenkov

Description

@amorenkov

agp = "8.9.1"
gradle = 8.11.1
grease = "0.3.4"

After trying android fused library (for my sample project works well, with some conditions) I decided to try your plugin and encountered a problem when calling build/assembly

Project structure:

[mylib]
+ - - - [core]
|          + - - - [utils]
|          + - - - [engine]
|                    + - - - [com.squareup.okhttp3:okhttp]
+ - - - [addons]

myLib.gradle.kts:

plugins {
    alias(libs.plugins.android.library)
    alias(libs.plugins.kotlin.android)
    alias(libs.plugins.thirdparty.grease)
}

android {
    namespace = "com.sample.mylib"
    compileSdk = 35

    defaultConfig {
        minSdk = 24

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
        consumerProguardFiles("consumer-rules.pro")
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_11
        targetCompatibility = JavaVersion.VERSION_11
    }
    kotlinOptions {
        jvmTarget = "11"
    }
}

dependencies {
    greaseTree(project(":core"))
    greaseTree(project(":addons"))
}

This is a very sample multimodule project (which contains only one sample class with sample function). The main idea is to get "fat-aar" which contains only my modules inside

Expected result: assemble/build = generated mylib-1.0.aar which contains all classes inside from [core], [engine], [utils], [addons] modules
Actual result:

Could not determine the dependencies of task ':mylib:bundleDebugAar'.
> Could not create task ':mylib:copyDebugJniLibsProjectAndLocalJars'.
   > 'org.gradle.api.file.FileCollection com.android.build.gradle.internal.tasks.LibraryJniLibsTask.getLocalJarsNativeLibs()'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions