Generar release de la aplicación

Generar release de la aplicación

ℹ️

Este proceso es obligatorio

La distribución de las aplicaciones .apk se realizan solo en modo release. En este modo, el código se compila y optimiza para obtener un rendimiento más eficiente, se eliminan mensajes de depuración y se aplican técnicas de ofuscación para mejorar la seguridad. Además, el tamaño del archivo resultante suele ser más pequeño, lo que facilita la distribución y descarga de la aplicación.

El modo release también permite activar ProGuard, una herramienta de minificación y obfuscación, que ayuda a proteger la propiedad intelectual del código y a reducir el riesgo de ingeniería inversa. A continuación, se comparte un ejemplo del archivo ProGuard:

# Keep specific classes
-keep class com.google.android.material.** { *; }
-keep class com.google.android.material.R$* { *; }
 
-dontwarn com.decodelibrary.R$raw
-dontwarn com.menta.android.ux.components.LibraryTheme
-dontwarn com.menta.android.ux.components.button.ButtonDefaultKt
-dontwarn com.menta.android.ux.components.button.ButtonRoundedKt
-dontwarn com.menta.android.ux.components.card.InformationCardData
-dontwarn com.menta.android.ux.components.card.InformationCardKt
-dontwarn com.menta.android.ux.components.layout.loading.LoadingData
-dontwarn com.menta.android.ux.components.layout.loading.LoadingLayoutKt
-dontwarn com.menta.android.ux.components.layout.status.StatusLayoutKt
-dontwarn com.menta.android.ux.components.layout.versioning.VersioningData
-dontwarn com.menta.android.ux.components.searchstatus.SearchStatusData
-dontwarn com.menta.android.ux.components.searchstatus.SearchStatusKt
-dontwarn com.menta.android.ux.components.searchstatus.SearchStatusType
-dontwarn com.menta.android.ux.components.servicesuggestion.Suggestion
-dontwarn com.menta.android.ux.components.servicesuggestion.SuggestionItemKt
-dontwarn com.menta.android.ux.components.servicesuggestion.SuggestionItemStyle
-dontwarn com.menta.android.ux.components.text.TextKt
-dontwarn com.menta.android.ux.components.textfield.TextFieldAmountKt
-dontwarn com.menta.android.ux.components.textfield.TextFieldRoundedKt
-dontwarn com.thoughtworks.xstream.XStream
 
# Keep specific libraries
-keep class retrofit2.** { *; }
-keep class com.squareup.okhttp3.** { *; }
-keep interface com.squareup.okhttp3.** { *; }
-dontwarn retrofit2.**
-dontwarn com.squareup.okhttp3.**
-keepattributes *Annotation*
-keepattributes EnclosingMethod
-keep interface java.util.function.**
# 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 uses generic type information stored in a class file when working with
# fields. Proguard removes such information by default, keep it.
-keepattributes Signature
 
# This is also needed for R8 in compat mode since multiple
# optimizations will remove the generic signature such as class
# merging and argument removal. See:
# https://r8.googlesource.com/r8/+/refs/heads/main/compatibility-faq.md#troubleshooting-gson-gson
-keep class com.google.gson.reflect.TypeToken { *; }
-keep class * extends com.google.gson.reflect.TypeToken
 
# Optional. For using GSON @Expose annotation
-keepattributes AnnotationDefault,RuntimeVisibleAnnotations
 
 
# Keep specific packages
-keep class com.urovo.** { *; }
-keep class com.menta.** { *; }
-keep class android.device.DeviceManager { *; }
 
 
# Keep public methods in Room database
-keepclassmembers class * extends androidx.room.RoomDatabase {
    public <init>(...);
    public abstract *;
}
 
# Keep all classes annotated with @androidx.room.* annotations
-keep class * extends androidx.room.RoomDatabase { *; }
-keep @androidx.room.* class * { *; }
 
-keep public class * extends android.database.sqlite.SQLiteOpenHelper
-keep class android.database.sqlite.** { *; }
-keep class android.** { *; }
 
# Keep public methods in SQLiteOpenHelper
-keep public class * extends android.database.sqlite.SQLiteOpenHelper {
    public <init>(...);
    public abstract *;
}