Merge pull request #7647 from element-hq/feature/bma/cleaupProguardFiles

Clean up ProGuard keep rules files
This commit is contained in:
Benoit Marty
2026-09-04 17:37:53 +02:00
committed by GitHub
18 changed files with 12 additions and 67 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ android {
buildTypes {
getByName("release") {
consumerProguardFiles("consumer-rules.pro")
consumerProguardFiles("consumer-rules.keep")
}
}
}
@@ -0,0 +1,5 @@
# Showkase generates this class, and Showkase's ShowkaseBrowserActivity loads it reflectively with
# Class.forName(...).getDeclaredConstructor().newInstance(), so its constructor must be kept too.
-keep class io.element.android.libraries.designsystem.showkase.DesignSystemShowkaseRootModuleCodegen {
<init>();
}
-23
View File
@@ -1,23 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-keep class io.element.android.libraries.designsystem.showkase.DesignSystemShowkaseRootModuleCodegen { }
-1
View File
@@ -17,7 +17,6 @@ android {
buildTypes {
release {
isMinifyEnabled = false
consumerProguardFiles("consumer-proguard-rules.pro")
}
}
}
@@ -1,21 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-6
View File
@@ -13,12 +13,6 @@ plugins {
android {
namespace = "io.element.android.libraries.network"
buildTypes {
release {
consumerProguardFiles("consumer-rules.pro")
}
}
}
setupDependencyInjection()
-9
View File
@@ -1,9 +0,0 @@
# From https://github.com/square/retrofit/issues/3751#issuecomment-1192043644
# Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
-keep,allowobfuscation,allowshrinking interface retrofit2.Call
-keep,allowobfuscation,allowshrinking class retrofit2.Response
# With R8 full mode generic signatures are stripped for classes that are not
# kept. Suspend functions are wrapped in continuations where the type argument
# is used.
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
@@ -26,10 +26,10 @@ android {
buildTypes {
getByName("release") {
consumerProguardFiles("consumer-proguard-rules.pro")
consumerProguardFiles("consumer-rules.keep")
}
register("nightly") {
consumerProguardFiles("consumer-proguard-rules.pro")
consumerProguardFiles("consumer-rules.keep")
matchingFallbacks += listOf("release")
}
}
@@ -1,4 +0,0 @@
# Fix this error:
# ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/bmarty/workspaces/element-x-android/app/build/outputs/mapping/nightly/missing_rules.txt.
# ERROR: R8: Missing class com.google.firebase.analytics.connector.AnalyticsConnector (referenced from: void com.google.firebase.messaging.MessagingAnalytics.logToScion(java.lang.String, android.os.Bundle) and 1 other context)
-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
@@ -0,0 +1,4 @@
# firebase-messaging references AnalyticsConnector, but we exclude firebase-analytics and
# firebase-measurement-connector from its dependencies (see build.gradle.kts), so R8 reports it as a
# missing class.
-dontwarn com.google.firebase.analytics.connector.AnalyticsConnector
View File