Our current ProGuard plugin is unfortunately not compatible with AGP 3.5+. This class used by our plugin was removed in AGP 3.5: ‘com.android.builder.core.AndroidBuilder’.
To use the current plugin, you’ll have to downgrade to AGP 3.4.
We’re working on a new plugin that will support newer AGP versions but it’s not available yet.
add the ProGuard plugin to the buildscripts dependencies in the root build.gradle
you can also ignore the warnings in the omniNotes/proguard-rules.txt file as if you don’t add this the build will fail telling you to correct the warnings
diff --git a/build.gradle b/build.gradle
index 1d186908..8465e4fe 100644
--- a/build.gradle
+++ b/build.gradle
@@ -26,6 +26,7 @@ buildscript {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.0"
classpath 'com.adarshr:gradle-test-logger-plugin:2.1.0'
+ classpath 'com.guardsquare:proguard-gradle:7.0.1'
}
// Exclude the version that the android plugin depends on.
configurations.classpath.exclude group: 'com.android.tools.external.lombok'
diff --git a/gradle.properties b/gradle.properties
index c640714a..68a18599 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -42,3 +42,6 @@ CRASH_REPORTING_URL=
VERSION_CHECK_URL=
# Google Maps API key to provide addresses autocompletion feature
MAPS_API_KEY=
+
+android.enableR8=false
+android.enableR8.libraries=false
diff --git a/omniNotes/proguard-rules.txt b/omniNotes/proguard-rules.txt
index 3b37fb6c..3ad677c7 100644
--- a/omniNotes/proguard-rules.txt
+++ b/omniNotes/proguard-rules.txt
@@ -5,6 +5,7 @@
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
+-ignorewarnings
# The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle.
-optimizations !code/simplification/arithmetic
Hello @james I have tried to implement the solution to overcome the issue of Metadata on Kotlin class on decompiling but your proposed solution do not work if “minifyEnabled true” as I get similar error as posted by Paul on his previous comments.
Whereas when “minifyEnabled false” I do not get any error but on decompiling my ARR, I can still see the Metadata in the decompiled class. If you are aware of any alternative approach or you feel I am doing something wrong please guide. Thanks
The instructions above are for an older version of ProGuard - could you try the instructions for the latest version in the manual here (“ProGuard Gradle Plugin (AGP version 4+)”): ProGuard Manual: Android Gradle | Guardsquare
Regarding the obfuscation of Kotlin metadata, you need to add -keepkotlinmetadata to you configuration for this to work.