solid-software / flutter_vlc_player

📺 Flutter VLC powered video player.
506 stars 247 forks source link

proguard issue #441

Open Ravan1190 opened 12 months ago

Ravan1190 commented 12 months ago

A problem occurred evaluating project ':app'.

Could not find method useProguard() for arguments [true] on BuildType$AgpDecorated_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=true, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=

luizbaldo commented 11 months ago

A problem occurred evaluating project ':app'.

Could not find method useProguard() for arguments [true] on BuildType$AgpDecorated_Decorated{name=release, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=true, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, mBuildConfigFields={}, mResValues={}, mProguardFiles=

TLDR: just remove the "useProguard true" line from your build.gradle, but keep other files and configs as mentioned on the package documentation

I was having the same issue. With some research I found out that this key "useProguard" is no longer being used. On the official documentation from Android, they explain that they are using R8 for shrinking and obfuscating files. But they assure that the projects using proguard should keep working. You can check more info on this page: https://developer.android.com/build/shrink-code#kts

In the end I fixed this error by removing the "useProguard true" flag, and just specifying some custom rules, that are documented on the vlc package. Now my build.gradle looks like this:

buildTypes {
    release {
        // TODO: Add your own signing config for the release build.
        // Signing with the debug keys for now, so `flutter run --release` works.
        signingConfig signingConfigs.debug
        minifyEnabled true
        proguardFiles getDefaultProguardFile(
                'proguard-android-optimize.txt'),
                'proguard-rules.pro'
    }
}

And you must create the proguard-rules.pro file, with the following content -keep class org.videolan.libvlc.** { *; }