I'm trying to compile the APK for Flutter, but I'm getting an error in r8. I already have other apps in Flutter, but I never had a problem compiling and making the tests with them. I realize that the problem is the WebView library because when I remove it from the pubspec the app compiles. But I can't discard the use of the WebView at the moment, it is important for the app. The strange thing is that I can debug the app on the device.
I've tried several solutions like the ones below:
gradlew clean in project-flutter / android
flutter clean
And the following steps:
- Updated to the latest version of webview dependency in the pub spec.
- I have already switched to the flutter master channel.
- Also performed the flutter upgrade but nothing solves the problem.
I get the following error:
R8: Program type already present: io.flutter.plugins.webviewflutter.BuildConfig
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:transformClassesAndResourcesWithR8ForRelease'. com.android.tools.r8.CompilationFailedException: Compilation failed to complete
ref r8: https://developer.android.com/studio/build/shrink-code?hl=pt-br