Gradle Solution for 'Invalid Signature file digest for Manifest main attribute'

Updated on Nov 21 2022 at the 23th hour

DISCLAIMER: Expressed views on this blog are my own.

You're here because you can't run your jar.

Typically caused by a dependency that includes cryptographic information that will mark your jar as signed. To fix it you need to include some exclusion rules to remove those files.

The rule can be under uberJar or Jar or whatever does packaging in your gradle build.


uberJar {
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}


An Android Application

packagingOptions {
  exclude 'META-INF/LICENSE'
  exclude 'META-INF/LICENSE.txt'
  exclude 'META-INF/MSFTSIG.SF'
  exclude 'META_INF/ECLIPSE_.SF'
  exclude("META-INF/*.kotlin_module")
}

You just read "Gradle Solution for 'Invalid Signature file digest for Manifest main attribute'". Please share if you liked it!
You can read more recent posts here.