Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: signed build issue with R8 full mode #26

Merged
merged 2 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ apply plugin: 'org.jetbrains.kotlin.android'
apply plugin: 'kotlin-parcelize'
apply plugin: 'kotlin-kapt'

if (fullstoryEnabled) {
apply plugin: 'fullstory'
}

if (firebaseEnabled) {
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.google.firebase.crashlytics'
Expand All @@ -33,6 +29,7 @@ if (firebaseEnabled) {
}

if (fullstoryEnabled) {
apply plugin: 'fullstory'
def fullstoryOrgId = fullstoryConfig?.get("ORG_ID")

fullstory {
Expand Down Expand Up @@ -110,6 +107,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}
buildFeatures {
viewBinding true
Expand Down
100 changes: 30 additions & 70 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
# 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

#====================/////Retrofit Rules\\\\\===============
# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Signature, InnerClasses, EnclosingMethod

# Retrofit does reflection on method and parameter annotations.
-keepattributes RuntimeVisibleAnnotations, RuntimeVisibleParameterAnnotations

# Keep annotation default values (e.g., retrofit2.http.Field.encoded).
-keepattributes AnnotationDefault

# Retain service method parameters when optimizing.
-keepclassmembers,allowshrinking,allowobfuscation interface * {
@retrofit2.http.* <methods>;
}

# Ignore JSR 305 annotations for embedding nullability information.
-dontwarn javax.annotation.**

# Guarded by a NoClassDefFoundError try/catch and only used when on the classpath.
-dontwarn kotlin.Unit

# Top-level functions that can only be used by Kotlin.
-dontwarn retrofit2.KotlinExtensions
-dontwarn retrofit2.KotlinExtensions$*

# With R8 full mode, it sees no subtypes of Retrofit interfaces since they are created with a Proxy
# and replaces all potential values with null. Explicitly keeping the interfaces prevents this.
-if interface * { @retrofit2.http.* <methods>; }
-keep,allowobfuscation interface <1>

# 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

#===============/////GSON RULES \\\\\\\============
##---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
Expand All @@ -69,12 +6,8 @@
# For using GSON @Expose annotation
-keepattributes *Annotation*

# Gson specific classes
-dontwarn sun.misc.**
#-keep class com.google.gson.stream.** { *; }

# Application classes that will be serialized/deserialized over Gson
-keep class org.openedx.*.data.model.** { <fields>; }
-keepclassmembers class org.openedx.**.data.model.** { *; }

# Prevent proguard from stripping interface information from TypeAdapter, TypeAdapterFactory,
# JsonSerializer, JsonDeserializer instances (so they can be used in @JsonAdapter)
Expand All @@ -85,13 +18,13 @@

# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
<init>();
@com.google.gson.annotations.SerializedName <fields>;
}

# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken

##---------------End: proguard configuration for Gson ----------

-keepclassmembers class * extends java.lang.Enum {
Expand All @@ -108,4 +41,31 @@
-dontwarn org.conscrypt.ConscryptHostnameVerifier
-dontwarn org.openjsse.javax.net.ssl.SSLParameters
-dontwarn org.openjsse.javax.net.ssl.SSLSocket
-dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn org.openjsse.net.ssl.OpenJSSE
-dontwarn com.google.crypto.tink.subtle.Ed25519Sign$KeyPair
-dontwarn com.google.crypto.tink.subtle.Ed25519Sign
-dontwarn com.google.crypto.tink.subtle.Ed25519Verify
-dontwarn com.google.crypto.tink.subtle.X25519
-dontwarn com.segment.analytics.kotlin.core.platform.plugins.logger.LogFilterKind
-dontwarn com.segment.analytics.kotlin.core.platform.plugins.logger.LogTargetKt
-dontwarn edu.umd.cs.findbugs.annotations.NonNull
-dontwarn edu.umd.cs.findbugs.annotations.Nullable
-dontwarn edu.umd.cs.findbugs.annotations.SuppressFBWarnings
-dontwarn org.bouncycastle.asn1.ASN1Encodable
-dontwarn org.bouncycastle.asn1.pkcs.PrivateKeyInfo
-dontwarn org.bouncycastle.asn1.x509.AlgorithmIdentifier
-dontwarn org.bouncycastle.asn1.x509.SubjectPublicKeyInfo
-dontwarn org.bouncycastle.cert.X509CertificateHolder
-dontwarn org.bouncycastle.cert.jcajce.JcaX509CertificateHolder
-dontwarn org.bouncycastle.crypto.BlockCipher
-dontwarn org.bouncycastle.crypto.CipherParameters
-dontwarn org.bouncycastle.crypto.InvalidCipherTextException
-dontwarn org.bouncycastle.crypto.engines.AESEngine
-dontwarn org.bouncycastle.crypto.modes.GCMBlockCipher
-dontwarn org.bouncycastle.crypto.params.AEADParameters
-dontwarn org.bouncycastle.crypto.params.KeyParameter
-dontwarn org.bouncycastle.jcajce.provider.BouncyCastleFipsProvider
-dontwarn org.bouncycastle.jce.provider.BouncyCastleProvider
-dontwarn org.bouncycastle.openssl.PEMKeyPair
-dontwarn org.bouncycastle.openssl.PEMParser
-dontwarn org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter
1 change: 1 addition & 0 deletions auth/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}
buildFeatures {
viewBinding true
Expand Down
30 changes: 8 additions & 22 deletions auth/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
# 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

-if class androidx.credentials.CredentialManager
-keep class androidx.credentials.playservices.** {
*;
}

# Prevent shrinking, optimization, and obfuscation of the library when consumed by other modules.
# This ensures that all classes and methods remain available for use by the consumer of the library.
# Disabling these steps at the library level is important because the main app module will handle
# shrinking, optimization, and obfuscation for the entire application, including this library.
-dontshrink
-dontoptimize
-dontobfuscate
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ ext {

firebase_version = "33.0.0"

retrofit_version = '2.9.0'
retrofit_version = '2.11.0'
logginginterceptor_version = '4.9.1'

koin_version = '3.2.0'
koin_version = '3.5.6'

coil_version = '2.3.0'

Expand Down
1 change: 1 addition & 0 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}

buildFeatures {
Expand Down
2 changes: 0 additions & 2 deletions core/consumer-rules.pro
Original file line number Diff line number Diff line change
@@ -1,2 +0,0 @@
-dontwarn java.lang.invoke.StringConcatFactory
-dontwarn org.openedx.core.R$string
30 changes: 7 additions & 23 deletions core/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
# 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

-dontwarn java.lang.invoke.StringConcatFactory
# Prevent shrinking, optimization, and obfuscation of the library when consumed by other modules.
# This ensures that all classes and methods remain available for use by the consumer of the library.
# Disabling these steps at the library level is important because the main app module will handle
# shrinking, optimization, and obfuscation for the entire application, including this library.
-dontshrink
-dontoptimize
-dontobfuscate
2 changes: 1 addition & 1 deletion core/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<uses-permission
android:name="com.google.android.gms.permission.AD_ID"
tools:node="remove" />
tools:node="merge" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application>
Expand Down
1 change: 1 addition & 0 deletions course/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}

buildFeatures {
Expand Down
28 changes: 7 additions & 21 deletions course/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
# 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
# Prevent shrinking, optimization, and obfuscation of the library when consumed by other modules.
# This ensures that all classes and methods remain available for use by the consumer of the library.
# Disabling these steps at the library level is important because the main app module will handle
# shrinking, optimization, and obfuscation for the entire application, including this library.
-dontshrink
-dontoptimize
-dontobfuscate
HamzaIsrar12 marked this conversation as resolved.
Show resolved Hide resolved
1 change: 1 addition & 0 deletions dashboard/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}

buildFeatures {
Expand Down
28 changes: 7 additions & 21 deletions dashboard/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
# 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
# Prevent shrinking, optimization, and obfuscation of the library when consumed by other modules.
# This ensures that all classes and methods remain available for use by the consumer of the library.
# Disabling these steps at the library level is important because the main app module will handle
# shrinking, optimization, and obfuscation for the entire application, including this library.
-dontshrink
-dontoptimize
-dontobfuscate
1 change: 1 addition & 0 deletions discovery/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}

buildFeatures {
Expand Down
28 changes: 7 additions & 21 deletions discovery/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
# 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
# Prevent shrinking, optimization, and obfuscation of the library when consumed by other modules.
# This ensures that all classes and methods remain available for use by the consumer of the library.
# Disabling these steps at the library level is important because the main app module will handle
# shrinking, optimization, and obfuscation for the entire application, including this library.
-dontshrink
-dontoptimize
-dontobfuscate
1 change: 1 addition & 0 deletions discussion/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ android {
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17
freeCompilerArgs = List.of("-Xstring-concat=inline")
}

buildFeatures {
Expand Down
Loading
Loading