Skip to content

fix minify proguard rules #104

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
43 changes: 43 additions & 0 deletions lib/araw-proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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

-keep class com.kirkbushman.auth.models.** {*;}
-keep class com.kirkbushman.auth.http.** {*;}

-keep class com.kirkbushman.araw.models.** {*;}
-keep class com.kirkbushman.araw.http.** {*;}

-keepattributes *Annotation*, Signature, Exception

# 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
-keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation

# https://stackoverflow.com/questions/77143071/r8-and-proguard-missing-class-error-in-data-class-that-is-using-keep-annotatio
-dontwarn java.lang.invoke.StringConcatFactory

# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.conscrypt.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**
13 changes: 13 additions & 0 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,26 @@ android {
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

buildTypes {
release {
minifyEnabled true
consumerProguardFiles 'araw-proguard-rules.pro'
}
debug {
minifyEnabled false
consumerProguardFiles 'araw-proguard-rules.pro'
}
}

compileOptions {
sourceCompatibility java_target
targetCompatibility java_target
}

kotlinOptions {
jvmTarget = jvm_target
// see https://github.com/Kotlin/kotlinx.serialization/issues/2145
freeCompilerArgs = ["-Xstring-concat=inline"]
}
}

Expand Down