Use built-in proguard rules and @Keep annotation

`-keepattributes LineNumberTable,SourceFile` is not needed since R8 v8.2
APK size is increased by 1.7% though
This commit is contained in:
FooIbar committed 2023-11-08 22:45:24 +08:00
1 parent 9daa05ef02
commit 74b79d9faa
7 files changed
+12 -33

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ android {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles("proguard-rules.pro")
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
signingConfig = signConfig
buildConfigField("String", "BUILD_TIME", "\"$buildTime\"")
}
-32
View File
@@ -1,34 +1,2 @@
-keepclassmembers class * implements android.os.Parcelable {
public static final ** CREATOR;
}
-keepclasseswithmembernames,includedescriptorclasses class * {
native <methods>;
}
# https://issuetracker.google.com/issues/190382641
-keepclassmembers class kotlin.SafePublicationLazyImpl {
java.lang.Object _value;
}
-keepclassmembers enum androidx.compose.material3.DrawerValue {
values();
}
-keep class androidx.viewpager.widget.ViewPager$LayoutParams { int position; }
-keep class com.hippo.ehviewer.client.parser.Torrent { *; }
-keep class com.hippo.ehviewer.client.parser.GalleryListResult { *; }
-keep class com.hippo.ehviewer.client.parser.Limits { *; }
-keep class com.hippo.ehviewer.client.data.BaseGalleryInfo { *; }
-keep class com.hippo.ehviewer.ui.scene.SearchBarScene { getBinding(); }
# Ktor logger
-dontwarn org.slf4j.impl.StaticLoggerBinder
-keepattributes LineNumberTable,SourceFile
-renamesourcefileattribute SourceFile
-repackageclasses
-allowaccessmodification
-overloadaggressively
@@ -16,6 +16,7 @@
package com.hippo.ehviewer.client.data
import android.os.Parcelable
import androidx.annotation.Keep
import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Ignore
@@ -23,6 +24,7 @@ import androidx.room.PrimaryKey
import com.hippo.ehviewer.client.data.GalleryInfo.Companion.NOT_FAVORITED
import kotlinx.parcelize.Parcelize
@Keep
@Parcelize
@Entity(tableName = "GALLERIES")
data class BaseGalleryInfo(
@@ -1,5 +1,6 @@
package com.hippo.ehviewer.client.parser
import androidx.annotation.Keep
import com.hippo.ehviewer.EhDB
import com.hippo.ehviewer.R
import com.hippo.ehviewer.client.data.BaseGalleryInfo
@@ -31,6 +32,7 @@ object GalleryListParser {
val emptyResult = GalleryListResult(null, null, arrayListOf())
}
@Keep
class GalleryListResult(
val prev: String?,
val next: String?,
@@ -1,6 +1,7 @@
package com.hippo.ehviewer.client.parser
import android.os.Parcelable
import androidx.annotation.Keep
import com.hippo.ehviewer.client.exception.InsufficientFundsException
import com.hippo.ehviewer.client.exception.ParseException
import java.nio.ByteBuffer
@@ -34,6 +35,7 @@ object HomeParser {
class Result(val limits: Limits, val funds: Funds)
}
@Keep
@Parcelize
data class Limits(val current: Int, val maximum: Int, val resetCost: Int) : Parcelable
@@ -1,5 +1,6 @@
package com.hippo.ehviewer.client.parser
import androidx.annotation.Keep
import com.hippo.ehviewer.client.exception.ParseException
import java.nio.ByteBuffer
@@ -9,6 +10,7 @@ object TorrentParser {
}.getOrElse { throw ParseException("Can't parse torrent list", it) }
}
@Keep
class Torrent(
val posted: String,
val size: String,
@@ -8,6 +8,7 @@ import android.view.View
import android.view.ViewGroup
import androidx.activity.OnBackPressedCallback
import androidx.annotation.CallSuper
import androidx.annotation.Keep
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.consumeWindowInsets
import androidx.compose.foundation.layout.imePadding
@@ -56,6 +57,8 @@ import kotlinx.coroutines.flow.toList
abstract class SearchBarScene : BaseScene(), ToolBarScene {
private var _binding: SceneSearchbarBinding? = null
@get:Keep
private val binding get() = _binding!!
private var mSuggestionList by mutableStateOf(emptyList<Suggestion>())
private var mSuggestionProvider: SuggestionProvider? = null