0

I have modules, app and favorite, and favorite module was dynamic features. I use navigation component, and My dynamic features graph that have detail page, and for detail page i use a fragment (RecipeInformation) in app module. like this:

enter image description here

it works fine, but there's an issue when i'm trying change minifyEnabled to true, (obfuscate) then, this error happen :

> Task :favorite:dexBuilderDebug
> Task :favorite:mergeProjectDexDebug

> Task :app:minifyDebugWithR8 FAILED
AGPBI: {"kind":"error","text":"Type com.example.recipes.ui.detail.RecipeInformationFragmentArgs$Companion is defined multiple times: C:\\Users\\wahyu\\rootProject\\Project\\Android\\Recipes\\app\\build\\intermediates\\module_and_runtime_deps_classes\\debug\\base.jar:com/example/recipes/ui/detail/RecipeInformationFragmentArgs$Companion.class, C:\\Users\\wahyu\\rootProject\\Project\\Android\\Recipes\\favorite\\build\\intermediates\\module_and_runtime_deps_classes\\debug\\feature-favorite.jar:com/example/recipes/ui/detail/RecipeInformationFragmentArgs$Companion.class","sources":[{"file":"C:\\Users\\wahyu\\rootProject\\Project\\Android\\Recipes\\app\\build\\intermediates\\module_and_runtime_deps_classes\\debug\\base.jar"}],"tool":"R8"}

enter image description here

i've try invalidating, rebuild, clean but it wont work. and i've try to refactor primitive id args with Parcelable and annotate it with @Keep (like documentation says) but it still has a same error. Here's my app build.gradle :

    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'androidx.navigation.safeargs.kotlin'
    id 'com.google.dagger.hilt.android'
}

apply from: "../shared_dependencies.gradle"

android {
    namespace 'com.example.recipes'
    compileSdk 33

    defaultConfig {
        applicationId "com.example.recipes"
        minSdk 21
        targetSdk 33
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
        debug {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    kotlinOptions {
        jvmTarget = '1.8'
    }
    buildFeatures {
        viewBinding true
    }
    dynamicFeatures = [':favorite']
}

dependencies {

    api project(":core")

    //? safeArgs
    api "androidx.navigation:navigation-fragment-ktx:2.5.3"
    api "androidx.navigation:navigation-ui-ktx:2.5.3"
    api "androidx.navigation:navigation-dynamic-features-fragment:2.5.3"


    //? ui
    implementation "androidx.drawerlayout:drawerlayout:1.1.1"
}

kapt {
    correctErrorTypes true
}

favorite build.gradle

    id 'com.android.dynamic-feature'
    id 'org.jetbrains.kotlin.android'
    id 'kotlin-kapt'
    id 'com.google.dagger.hilt.android'
    id 'androidx.navigation.safeargs.kotlin'
}

apply from: "../shared_dependencies.gradle"

android {
    namespace 'com.example.recipe.favorite'
    compileSdk 33

    buildFeatures{
        viewBinding true
    }

    defaultConfig {
        minSdk 21
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation project(":app")
    implementation project(":core")
}

what seem's to be the problem? i need help

Kakaranara
  • 97
  • 2
  • 7

0 Answers0