crash of Android app in release mode : java.lang.IllegalArgumentException

[EDIT] : please find the added AndroidManifest.xml

My perfectly fonctionnal app in debug mode crashes on Start in release mode.
“excepton occured: Multiple entries with same key: e4.b=true and e4.b=true”

Manifest :

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:installLocation="preferExternal"
    android:requestLegacyExternalStorage="true">

    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.VIBRATE" />

    <uses-permission
        android:name="android.permission.READ_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE"
        android:maxSdkVersion="32" />
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />

    <uses-feature android:name="android.hardware.camera" />
    <uses-permission android:name="android.permission.CAMERA" />

    <queries>
        <intent>
            <action android:name="android.intent.action.TTS_SERVICE" />
        </intent>
    </queries>

    <application
        android:name=".HiltWms"
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/Theme.App.Starting"
        tools:targetApi="31">

        <receiver
            android:name=".helper.download.DownloadCompletedReceiver"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.DOWNLOAD_COMPLETE" />
            </intent-filter>
        </receiver>

        <activity
            android:name=".MainActivity"
            android:exported="true"
            android:theme="@style/Theme.MyApp">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name=".HomeActivity"
            android:exported="false"
            android:label="@string/title_activity_home"
            android:theme="@style/Theme.MyApp" />
        <activity
            android:name=".ScanActivity"
            android:exported="false"
            android:label="@string/title_activity_scan"
            android:theme="@style/Theme.MyApp" />
        <activity
            android:name=".CrashActivity"
            android:exported="false"
            android:label="@string/title_activity_crash"
            android:theme="@style/Theme.MyApp" />

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.provider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/provider_paths" />
        </provider>
    </application>
</manifest>

Here’s the log :

FATAL EXCEPTION: main
Process: release.example.myapp, PID: 18110
java.lang.IllegalArgumentException: Multiple entries with same key: e4.b=true and e4.b=true
at f5.e.a(SourceFile:45)
at A4.h.e(SourceFile:464)
at S2.G.a(SourceFile:55)
at X4.m5.b(SourceFile:11)
at S2.Y.g(SourceFile:10)
at Y4.u3.a(SourceFile:21)
at X4.f5.a(SourceFile:162)
at S2.l0.o(SourceFile:174)
at B0.c.o(SourceFile:52)
at k0.k0.o(SourceFile:170)
at B0.c.o(SourceFile:52)
at t0.d.b(SourceFile:150)
at q0.J1.a(SourceFile:128)
at S2.l0.o(SourceFile:79)
at B0.c.o(SourceFile:52)
at t0.d.a(SourceFile:233)
at q0.p2.a(SourceFile:77)
at D1.o.o(SourceFile:318)
at B0.c.o(SourceFile:52)
at t0.d.b(SourceFile:150)
at q0.K0.a(SourceFile:224)
at G3.e.a(SourceFile:1048)
at S2.m0.o(SourceFile:350)
at B0.c.o(SourceFile:52)
at f1.l0.a(SourceFile:70)
at D0.y.o(SourceFile:671)
at B0.c.o(SourceFile:52)
at t0.d.b(SourceFile:150)
at f1.m0.a(SourceFile:309)
at O3.l.o(SourceFile:1409)
at B0.c.o(SourceFile:52)
at t0.d.b(SourceFile:150)
at androidx.compose.ui.platform.AndroidCompositionLocals_androidKt.a(SourceFile:592)
at f1.p1.o(SourceFile:250)
at B0.c.o(SourceFile:52)
at t0.d.a(SourceFile:233)
at f1.p1.o(SourceFile:213)
at B0.c.o(SourceFile:52)
at t0.d.L(SourceFile:15)
at t0.p.p(SourceFile:203)
at t0.t.k(SourceFile:32)
at t0.t0.a(SourceFile:44)
at t0.t.l(SourceFile:9)
at t0.t.b(SourceFile:3)
at a0.j0.q(SourceFile:1015)
at f1.v.setOnViewTreeOwnersAvailable(SourceFile:7)
at f1.q1.b(SourceFile:10)
at f1.q1.i(SourceFile:19)
at androidx.lifecycle.u.a(SourceFile:23)
at androidx.lifecycle.v.a(SourceFile:216)
at a0.j0.q(SourceFile:984)
at f1.v.onAttachedToWindow(SourceFile:120)
at android.view.View.dispatchAttachedToWindow(View.java:20109)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3430)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3437)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2050)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1743)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7772)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1036)
at android.view.Choreographer.doCallbacks(Choreographer.java:859)
at android.view.Choreographer.doFrame(Choreographer.java:794)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1021)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7397)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

It could be incompatible librairies versions, here is my build.gradle (Project) and (app)

buildscript {
    ext {
        // core
        kotlin_core = '1.13.1'
        // base
        activity_compose_version = '1.9.2'
        compose_version = '1.7.0'
        material_version = '1.7.0'
        material3_version = '1.3.0'
        material_icon_version = '1.7.0'
        navigation_compose_version = '2.8.0'
        lifecycle_version  = '2.8.5'
        hilt_version = '2.52'
        hilt_navigation_version = '1.2.0'
        room_version = '2.6.1'
        core_splashscreen_version = '1.0.1'
        composeAnimation = '1.7.0'
    }
    dependencies {
        classpath "com.google.dagger:hilt-android-gradle-plugin:$hilt_version"
    }
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
    id 'com.android.application' version '8.5.2' apply false // 8.0.2
    id 'com.android.library' version '8.5.2' apply false // 8.0.2
    id 'org.jetbrains.kotlin.android' version '1.9.24' apply false
    id 'org.jetbrains.kotlin.jvm' version '1.7.0' apply false
}

tasks.register('clean', Delete) {
    delete rootProject.layout.buildDirectory
}
plugins {
    id 'com.android.application'
    id 'org.jetbrains.kotlin.android'
    id "dagger.hilt.android.plugin"
    id 'kotlin-kapt'
}

android {
    namespace 'com.example.myapp'
    compileSdk 34

    defaultConfig {
//        applicationId "test.example.myapp"
        applicationId "release.example.myapp"
        minSdk 25
        targetSdk 34
        versionCode 2
        versionName "0.0.2"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        vectorDrawables {
            useSupportLibrary true
        }

        // Required when setting minSdkVersion to 20 or lower
//        multiDexEnabled true
    }

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

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17

        // Flag to enable support for the new language APIs
        coreLibraryDesugaringEnabled true
    }
    kotlinOptions {
        jvmTarget = '17'
    }
    buildFeatures {
        compose true
        buildConfig = true
    }
    composeOptions {
        kotlinCompilerExtensionVersion '1.5.14'
    }
    packagingOptions {
        resources {
            excludes += '/META-INF/{AL2.0,LGPL2.1}'
        }
    }
}

dependencies {
    implementation "androidx.core:core-ktx:$kotlin_core"
    implementation "androidx.lifecycle:lifecycle-runtime-ktx:$lifecycle_version "
    implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version "
    implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$lifecycle_version"
    implementation "androidx.activity:activity-compose:$activity_compose_version"
    implementation "androidx.compose.ui:ui:$compose_version"
    implementation "androidx.compose.ui:ui-tooling-preview:$compose_version"
    implementation "androidx.compose.material:material:$material_version"
    implementation "androidx.compose.material3:material3:$material3_version"
    implementation "androidx.compose.animation:animation-android:$composeAnimation"
    implementation "androidx.navigation:navigation-compose:$navigation_compose_version"
    implementation 'androidx.compose.ui:ui-graphics'
    implementation platform('androidx.compose:compose-bom:2024.09.00')
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.2.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
    androidTestImplementation "androidx.compose.ui:ui-test-junit4:$compose_version"
    androidTestImplementation platform('androidx.compose:compose-bom:2024.09.00')
    debugImplementation "androidx.compose.ui:ui-tooling:$compose_version"
    debugImplementation "androidx.compose.ui:ui-test-manifest:$compose_version"
    // Icons
    implementation "androidx.compose.material:material-icons-extended:$material_icon_version"
    // DataStore
    implementation "androidx.datastore:datastore-preferences:1.1.1"
    implementation 'androidx.datastore:datastore-preferences-rxjava2:1.1.1'
    implementation 'androidx.datastore:datastore-preferences-rxjava3:1.1.1'
    implementation "androidx.datastore:datastore:1.1.1"
    implementation 'androidx.datastore:datastore-rxjava2:1.1.1'
    implementation 'androidx.datastore:datastore-rxjava3:1.1.1'

    // Hilt
    implementation "androidx.hilt:hilt-navigation-compose:$hilt_navigation_version"
    implementation "com.google.dagger:hilt-android:$hilt_version"
    kapt "com.google.dagger:hilt-android-compiler:$hilt_version"

    //Room
    implementation "androidx.room:room-runtime:$room_version"
    implementation "androidx.room:room-ktx:$room_version"
    kapt "androidx.room:room-compiler:$room_version"
    // Splash API
    implementation "androidx.core:core-splashscreen:$core_splashscreen_version"
    // HTTP calls
    implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.14'
    // JSON handler
    implementation 'com.google.code.gson:gson:2.11.0'
    // system bars customization
    implementation 'com.google.accompanist:accompanist-systemuicontroller:0.36.0'

    implementation 'io.reactivex.rxjava3:rxandroid:3.0.2'
    implementation 'io.reactivex.rxjava3:rxjava:3.1.9'

    implementation 'androidx.appcompat:appcompat:1.7.0' // 1.4.0
    implementation 'com.google.mlkit:barcode-scanning:17.3.0' //17.0.3'
    implementation 'com.google.android.gms:play-services-mlkit-barcode-scanning:18.3.1' //18.1.0

    def camerax_version = '1.3.4'  //"1.0.2"
    implementation "androidx.camera:camera-core:${camerax_version}"
    implementation "androidx.camera:camera-camera2:${camerax_version}"
    implementation "androidx.camera:camera-lifecycle:${camerax_version}"
    implementation "androidx.camera:camera-view:${camerax_version}" // 1.0.0-alpha29

    // Camera Permission
    implementation 'com.google.accompanist:accompanist-permissions:0.36.0'
    implementation 'com.google.guava:guava:33.3.0-android'

    // Coil animation
    implementation 'io.coil-kt:coil:2.7.0'
    implementation 'io.coil-kt:coil-gif:2.7.0'
    implementation 'io.coil-kt:coil-compose:2.7.0'
    // For AGP 7.4+
    coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.1.2'
}

// Allow references to generated code
kapt {
    correctErrorTypes true
    useBuildCache = true
}

configurations {
    // Resolves dependency conflict caused by some dependencies use
    // com.google.guava:guava and com.google.guava:listenablefuture together.
    all*.exclude group: 'com.google.guava', module: 'listenablefuture'
}

I know it could be about the proguard obfuscation rules but I don’t know where to start to add the correct rules.

Thank you if you can help me !

6

Thanks to @Gg M I found a line in refering to the error” Multiple entries with same key: e4.b=true and e4.b=true”
In my-appappbuildoutputsmappingreleasemapping.txt :

com.example.myapp.views.prints.PrintsViewModel -> e4.b:

We can’t instantiate multiple viewModel consumming the same Repository.
Example :

class GeneralViewModel @Inject constructor(
    private val repoPrint: PrintRepository
) : ViewModel() { 
    val printsList = repoPrint.getPrintsFromRoom()
}

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật