Navjot
Navjot

Reputation: 1294

Unable to remove "-ignorewarnings" from R8 Configuration (Android Proguard Issue)

I am trying to build an android app with proguard and r8 enabled. I have added "-printconfiguration full-r8-config.txt" to print the Full R8 Configuration.

Problem: Even after. having zero dependencies in the build.gradle, I am getting the following entry at the end of the file full-r8-config.txt

# The proguard configuration file for the following section is <unknown>
-ignorewarnings
# End of content from <unknown>

This means proguard is ignoring the warnings while building the application. I want to remove this entry as ignoring warnings can be dangerous. Unable to figure out <unknown> in this entry.

More Details:

proguard-rules.pro

-printconfiguration full-r8-config.txt

App -> build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 29
    buildToolsVersion "29.0.3"

    defaultConfig {
        applicationId "com.proguard.kotlintest2"
        minSdkVersion 19
        targetSdkVersion 29
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

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

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

Project -> build.gradle

buildscript {
    ext.kotlin_version = "1.3.72"
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.0.0"
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

gradle.properties

org.gradle.jvmargs=-Xmx2048m

gradle-wrapper.properties

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

Upvotes: 1

Views: 1228

Answers (1)

sgjesse
sgjesse

Reputation: 4613

Right now the -ignorewarnings options is forced by the Android Gradle Plugin when using R8, and there is no way of disabling it.

The rationale for this was that many existing configuration files was using -dontwarn quite extensively, and there was no good way to be compatible with Proguard when it came to warnings.

Upvotes: 2

Related Questions