Scandit / scandit-capacitor-datacapture-core

0 stars 3 forks source link

[Android] Build with "minifyEnabled true" not working #2

Closed aaronbach closed 2 years ago

aaronbach commented 2 years ago

Im using Capacitor 3 in combination with proguard in android. The debug build is working great, but the production build is not working.

The Problem is, when I set minifyEnabled true in build.gradle, I get the following Error, when I call await ScanditCaptureCorePlugin.initializePlugins(); in Typescript.

Here are my Proguard Rules, to ignore general Capacitor Plugins during minification.

-keep public class * extends com.getcapacitor.Plugin

-keep @com.getcapacitor.annotation.CapacitorPlugin public class * {
    @com.getcapacitor.annotation.PermissionCallback <methods>;
    @com.getcapacitor.annotation.ActivityCallback <methods>;
    @com.getcapacitor.PluginMethod public <methods>;
}

-keep,allowobfuscation @interface com.getcapacitor.NativePlugin,com.getcapacitor.PluginMethod
-keep @com.getcapacitor.NativePlugin class * { *; }
-keepclasseswithmembernames class * {
  @com.getcapacitor.PluginMethod public *;
}

-keep public class * extends org.apache.cordova.* {
    public <methods>;
    public <fields>;
}

I also tried the following:

-keep public class * extends com.scandit.* {
    public <methods>;
    public <fields>;
}

but I still get the same Error (please see Screenshot).

Am I missing something?

We are a paying Scandit Customer, please let me know if this is the wrong place for Support.

image

Thanks

ScanditSupport commented 2 years ago

Hi @aaronbach

You can try to exclude completely our plugins from being obfuscated by adding:

-keep public class com.scandit.capacitor.** {
public protected *;
}

In case you have more detailed questions, please feel free to reach out to us directly:

Submit a request – Frequently Asked Questions (FAQ)

aaronbach commented 2 years ago

Thanks @ScanditSupport this is working for me