forked from firka/firka
fix(android): resolve ProGuard configuration path in release builds
This commit is contained in:
@@ -59,7 +59,7 @@ android {
|
||||
if (config != null) {
|
||||
signingConfig = config
|
||||
}
|
||||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
|
||||
proguardFiles("proguard-rules.pro")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -94,6 +94,26 @@ tasks.register("ensureEnv") {
|
||||
tasks.matching { it.name.startsWith("compileFlutterBuild") }.configureEach {
|
||||
dependsOn("ensureEnv")
|
||||
}
|
||||
|
||||
// Ensure default ProGuard files exist at the projectDir location expected by AGP/R8 when build directory is relocated
|
||||
val defaultProguardDir = file("${project.projectDir}/build/intermediates/default_proguard_files/global")
|
||||
defaultProguardDir.mkdirs()
|
||||
val defaultProguardOptimize = File(defaultProguardDir, "proguard-android-optimize.txt-9.2.0")
|
||||
if (!defaultProguardOptimize.exists()) {
|
||||
defaultProguardOptimize.writeText("-allowaccessmodification\n")
|
||||
}
|
||||
tasks.register("ensureProguardFiles") {
|
||||
doLast {
|
||||
defaultProguardDir.mkdirs()
|
||||
if (!defaultProguardOptimize.exists()) {
|
||||
defaultProguardOptimize.writeText("-allowaccessmodification\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
tasks.matching { it.name.startsWith("compile") || it.name.contains("minify", ignoreCase = true) || it.name.contains("r8", ignoreCase = true) }.configureEach {
|
||||
dependsOn("ensureProguardFiles")
|
||||
}
|
||||
|
||||
flutter {
|
||||
source = "../.."
|
||||
}
|
||||
76
firka/android/app/proguard-rules.pro
vendored
76
firka/android/app/proguard-rules.pro
vendored
@@ -1 +1,75 @@
|
||||
-keep class app.firka.naplo.glance.** { *; }
|
||||
# Firka custom keep rules
|
||||
-keep class app.firka.naplo.glance.** { *; }
|
||||
|
||||
# Android optimize rules (-allowaccessmodification)
|
||||
-allowaccessmodification
|
||||
|
||||
# Android common keep rules
|
||||
-keepattributes AnnotationDefault,
|
||||
EnclosingMethod,
|
||||
InnerClasses,
|
||||
RuntimeVisibleAnnotations,
|
||||
RuntimeVisibleParameterAnnotations,
|
||||
RuntimeVisibleTypeAnnotations,
|
||||
Signature
|
||||
|
||||
-keep public class com.google.vending.licensing.ILicensingService
|
||||
-keep public class com.android.vending.licensing.ILicensingService
|
||||
-keep public class com.google.android.vending.licensing.ILicensingService
|
||||
-dontnote com.android.vending.licensing.ILicensingService
|
||||
-dontnote com.google.vending.licensing.ILicensingService
|
||||
-dontnote com.google.android.vending.licensing.ILicensingService
|
||||
|
||||
# Native methods
|
||||
-keepclasseswithmembernames,includedescriptorclasses class * {
|
||||
native <methods>;
|
||||
}
|
||||
|
||||
# Keep setters in Views so that animations can still work.
|
||||
-keepclassmembers public class * extends android.view.View {
|
||||
void set*(***);
|
||||
*** get*();
|
||||
}
|
||||
|
||||
# We want to keep methods in Activity that could be used in the XML attribute onClick.
|
||||
-keepclassmembers class * extends android.app.Activity {
|
||||
public void *(android.view.View);
|
||||
}
|
||||
|
||||
# For enumeration classes
|
||||
-keepclassmembers enum * {
|
||||
public static **[] values();
|
||||
public static ** valueOf(java.lang.String);
|
||||
}
|
||||
|
||||
-keepclassmembers class * implements android.os.Parcelable {
|
||||
public static final ** CREATOR;
|
||||
}
|
||||
|
||||
# Preserve annotated Javascript interface methods.
|
||||
-keepclassmembers class * {
|
||||
@android.webkit.JavascriptInterface <methods>;
|
||||
}
|
||||
|
||||
# The support libraries contains references to newer platform versions.
|
||||
-dontnote android.support.**
|
||||
-dontnote androidx.**
|
||||
-dontwarn android.support.**
|
||||
-dontwarn androidx.**
|
||||
|
||||
# Understand the @Keep support annotation.
|
||||
-keep class android.support.annotation.Keep
|
||||
-keep @android.support.annotation.Keep class * {*;}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <methods>;
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <fields>;
|
||||
}
|
||||
-keepclasseswithmembers class * {
|
||||
@android.support.annotation.Keep <init>(...);
|
||||
}
|
||||
|
||||
-dontnote org.apache.http.**
|
||||
-dontnote android.net.http.**
|
||||
-dontnote java.lang.invoke.**
|
||||
@@ -15,3 +15,6 @@ kotlin.incremental.useClasspathSnapshot=true
|
||||
android.builtInKotlin=false
|
||||
|
||||
android.newDsl=false
|
||||
|
||||
# Prevent AGP 9.0+ build failures due to relocated build directory ProGuard path mismatches
|
||||
android.proguard.failOnMissingFiles=false
|
||||
|
||||
Reference in New Issue
Block a user