Skip to content

Commit

Permalink
I have worked on:
Browse files Browse the repository at this point in the history
- Fixed proguard issue
  • Loading branch information
AliAzaz committed Sep 22, 2023
1 parent 65cb4d4 commit 00c6411
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dispatch_git_artifact_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
- name: Set EXCLUDE_LIB_CPP environment variable
run: echo "EXCLUDE_LIB_CPP=true" >> $GITHUB_ENV

- name: Build debuging APK 🔥
- name: Build debugging APK 🔥
run: bash ./gradlew assembleDebug
if: success()

- name: Uploading APK to Github Artifacts 🚀
uses: actions/upload-artifact@v3
with:
name: app-debug.apk
path: app/build/outputs/apk/debug/app-debug.apk
name: ${{ env.APK_NAME }}
path: app/build/outputs/apk/debug/${{ env.APK_NAME }}
env:
APK_NAME: "app-debug.apk"
12 changes: 7 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ android {

buildTypes {
release {
// to remove unused resources. This will reduce APK size.
shrinkResources true
//To obfuscate the code and to remove unused code. This will improve code security and will reduce APK size.
minifyEnabled true
signingConfig signingConfigs.release
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}

debug {
shrinkResources false // to remove unused resources. This will reduce APK size.
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
Expand All @@ -60,11 +64,9 @@ android {
/*
* Cmake checking
* */
if (project.hasProperty('useCMake') && project.property('useCMake').toString() == 'true') {
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
externalNativeBuild {
cmake {
path "CMakeLists.txt"
}
}
}
Expand Down
104 changes: 98 additions & 6 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,102 @@
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# Ignore annotation used for build tooling.
-dontwarn org.codehaus.mojo.animal_sniffer.*

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
# OkHttp platform used only on JVM and when Conscrypt and other security providers are available.
-dontwarn okhttp3.internal.platform.**
-dontwarn org.bouncycastle.**
-dontwarn org.openjsse.**

# 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 okio.**
-dontwarn okhttp3.**
-dontwarn javax.annotation.**
-dontwarn org.conscrypt.**
-dontwarn org.joda.**
-keep class com.squareup.** { *; }

-keepclasseswithmembernames class * {
native <methods>;
}

-keep class java.io.** { *; }
-keep class android.support.** { *; }
-keep interface android.support.** { *; }

-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.ParametersAreNonnullByDefault

-keep class **$$ViewBinder { *; }
-renamesourcefileattribute SourceFile

-keep public class * extends java.lang.Exception
-keepattributes SourceFile,LineNumberTable

-keepclasseswithmembernames class * {
@butterknife.* <fields>;
}

-keepclasseswithmembernames class * {
@butterknife.* <methods>;
}

-keepnames class * implements android.os.Parcelable {
public static final ** CREATOR;
}

-keep public class * implements com.bumptech.glide.module.GlideModule
-keep public class * extends com.bumptech.glide.module.AppGlideModule
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
**[] $VALUES;
public *;
}


# Retrofit does reflection on generic parameters. InnerClasses is required to use Signature and
# EnclosingMethod is required to use InnerClasses.
-keepattributes Exceptions, Signature, InnerClasses, EnclosingMethod

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

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

-keep class androidx.lifecycle.** { *; }
-keep class androidx.arch.core.** { *; }

-keepattributes Signature
-keepattributes *Annotation*
-keep class okhttp3.** { *; }
-keep interface okhttp3.** { *; }

-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }

-dontwarn com.squareup.okhttp.**
-keep class com.facebook.jni.** { *; }
-keep class com.facebook.flipper.** { *; }

#Not show logs
-assumenosideeffects class android.util.Log {
public static boolean isLoggable(java.lang.String, int);
public static int d(...);
public static int w(...);
public static int v(...);
public static int i(...);
public static int e(...);
}

#custom modules
-keep class com.example.pixabaygalleryapp.model.** { *; }
3 changes: 1 addition & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,4 @@ android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
#For CICD build genearation
PIXABAY_KEY="PIXABAY_KEY"
useCMake=true
PIXABAY_KEY="PIXABAY_KEY"

0 comments on commit 00c6411

Please sign in to comment.