Skip to content

Commit

Permalink
Setup proguard.
Browse files Browse the repository at this point in the history
  • Loading branch information
braniii committed Oct 27, 2023
1 parent b94ce7e commit b013ed2
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
17 changes: 17 additions & 0 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,25 @@ android {
buildTypes {
release {
signingConfig signingConfigs.release
// Enables code shrinking, obfuscation, and optimization for only
// your project's release build type. Make sure to use a build
// variant with `debuggable false`.
minifyEnabled true

// Enables resource shrinking, which is performed by the
// Android Gradle plugin.
shrinkResources true

// Includes the default ProGuard rules files that are packaged with
// the Android Gradle plugin. To learn more, go to the section about
// R8 configuration files.
proguardFiles getDefaultProguardFile(
'proguard-android-optimize.txt'),
'proguard-rules.pro'

}
}
namespace 'de.quantumphysique.trale'
}

flutter {
Expand Down
53 changes: 53 additions & 0 deletions app/android/app/proguard-android-optimize.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Flutter
-keep class io.flutter.app.** { *; }
-keep class io.flutter.plugin.** { *; }
-keep class io.flutter.util.** { *; }
-keep class io.flutter.view.** { *; }
-keep class io.flutter.** { *; }
-keep class io.flutter.plugins.** { *; }

# Retrofit
-keepattributes Signature
-keepattributes Exceptions

# Other
-keepattributes *Annotation*
-keepattributes SourceFile, LineNumberTable

# Logging
-assumenosideeffects class android.util.Log {
public static *** d(...);
public static *** v(...);
public static *** i(...);
public static *** w(...);
public static *** e(...);
public static *** wtf(...);
}

-assumenosideeffects class io.flutter.Log {
public static *** d(...);
public static *** v(...);
public static *** w(...);
public static *** e(...);
}

-assumenosideeffects class java.util.logging.Level {
public static *** w(...);
public static *** d(...);
public static *** v(...);
}

-assumenosideeffects class java.util.logging.Logger {
public static *** w(...);
public static *** d(...);
public static *** v(...);
}

# Removes third parties logging
-assumenosideeffects class org.slf4j.Logger {
public *** trace(...);
public *** debug(...);
public *** info(...);
public *** warn(...);
public *** error(...);
}
1 change: 1 addition & 0 deletions app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package="com.gitlab.mobilemovement.trale.app">
<application
android:label="trale"
android:usesCleartextTraffic="false"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
Expand Down

0 comments on commit b013ed2

Please sign in to comment.