NullPointerException
NullPointerException

Reputation: 37721

How to tell Proguard to obfuscate ONLY my package?

I have a Compose Desktop application with a lot of dependencies, and it's becoming difficult to make it work with Proguard. Everything works without it, but everything breaks with Proguard. I need to obfuscate my personal classes, so Proguard is a requisite.

After research and adding near 200 lines of Proguard config, the app starts, but it fails when using Jackson and Retrofit for downloading and parsing an XML file, and yes, I have a lot of Retrofit, JSON, Jackson etc.. rules.

Finally I'm trying my last hope, to find a way to tell Proguard to NOT TOUCHING OR OBFUSCATING ANY OF THE DEPENDENCIES and just obfuscate my app package, which is com.myapp.core and every subpackage contained on it.

Is that possible?

I tried this with no result:

-keep class !com.myapp.core.** { *; }

These are my dependencies:

    commonMain.dependencies {
        implementation(compose.runtime)
        implementation(compose.foundation)
        implementation(compose.material3)
        implementation(compose.ui)
        implementation(compose.components.resources)
        implementation(compose.components.uiToolingPreview)
        implementation(libs.androidx.lifecycle.viewmodel)
        implementation(libs.androidx.lifecycle.runtime.compose)
        implementation(project.dependencies.platform(libs.koin.bom))
        implementation(libs.koin.core)
        implementation(libs.koin.compose)
        implementation(libs.koin.compose.viewmodel.navigation)
        implementation(libs.retrofit)
        implementation(libs.converter.jackson)
        implementation(libs.jackson.module.kotlin)
        implementation(libs.jackson.dataformat.xml)
        implementation(libs.converter.scalars)
        implementation(libs.okhttp)
        implementation(libs.androidx.sqlite.bundled)
        implementation(libs.androidx.room.runtime)
        implementation(libs.navigation.compose)
        implementation(libs.datastore.preferences)
    }
    desktopMain.dependencies {
        implementation(compose.desktop.currentOs)
        implementation(libs.kotlinx.coroutines.swing)
    }

Upvotes: 0

Views: 37

Answers (0)

Related Questions