Open evgfilim1 opened 4 months ago
I'm having the same problem. There is no error when I remove flutter_secure_storage from my app.
After applying it, the project compiles successfully and seems like no errors are emitted at runtime.
android/app/proguard-rules.pro
if it doesn't exist yet.# https://github.com/mogol/flutter_secure_storage/issues/748
-dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue
-dontwarn com.google.errorprone.annotations.CheckReturnValue
-dontwarn com.google.errorprone.annotations.Immutable
-dontwarn com.google.errorprone.annotations.RestrictedApi
-dontwarn javax.annotation.Nullable
-dontwarn javax.annotation.concurrent.GuardedBy
I will add the workaround above to the package asap.
Execution failed for task ':app:minifyReleaseWithR8'. help me
ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/macbook/projects/tenh100-ecom/build/app/outputs/mapping/release/missing_rules.txt. ERROR: R8: Missing class org.slf4j.impl.StaticLoggerBinder (referenced from: void org.slf4j.LoggerFactory.bind() and 3 other contexts)
FAILURE: Build failed with an exception.
What went wrong: Execution failed for task ':app:minifyReleaseWithR8'.
A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable Compilation failed to complete
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. Get more help at https://help.gradle.org.
this flutter_secure_storage is the issue
Workaround
After applying it, the project compiles successfully and seems like no errors are emitted at runtime.
- Create a new file named
android/app/proguard-rules.pro
if it doesn't exist yet.- Copy-paste the content below to the file.
# https://github.com/mogol/flutter_secure_storage/issues/748 -dontwarn com.google.errorprone.annotations.CanIgnoreReturnValue -dontwarn com.google.errorprone.annotations.CheckReturnValue -dontwarn com.google.errorprone.annotations.Immutable -dontwarn com.google.errorprone.annotations.RestrictedApi -dontwarn javax.annotation.Nullable -dontwarn javax.annotation.concurrent.GuardedBy
this solved the problem
For anyone caring about this issue: it is a really, really bad workaround to suppress all errors with -dontwarn
.
This error, which was a compile warning before AGP 8.0, has now been elevated to a compile error. Essentially, it is trying to tell you that some classes referenced in your project cannot be found.
In some cases, you can still ignore it completely using -dontwarn
like you did before AGP 8.0; however, in most cases, you should find the missing classes rather than suppressing the error to avoid ignoring the underlying issues.
Let's take a look at the missing classes in this issue:
For com.google.errorprone.annotations.*
, it's clear that it is part of the error_prone_annotations
package.
For javax.annotation.Nullable
, it is actually part of the optional feature called JSR 305. The most "popular" implementation available atm is spotbugs-annotations
.
So the solution is clear:
Add these lines to your android/app/build.gradle
's dependencies
section:
implementation 'com.google.errorprone:error_prone_annotations:2.36.0' // required by flutter_secure_storage
implementation 'com.github.spotbugs:spotbugs-annotations:4.8.6' // required by flutter_secure_storage
Replace the version codes with the most recent ones you find in the links above.
For anyone caring about this issue: it is a really, really bad workaround to suppress all errors with
-dontwarn
.This error, which was a compile warning before AGP 8.0, has now been elevated to a compile error. Essentially, it is trying to tell you that some classes referenced in your project cannot be found.
In some cases, you can still ignore it completely using
-dontwarn
like you did before AGP 8.0; however, in most cases, you should find the missing classes rather than suppressing the error to avoid ignoring the underlying issues.Let's take a look at the missing classes in this issue:
For
com.google.errorprone.annotations.*
, it's clear that it is part of theerror_prone_annotations
package.For
javax.annotation.Nullable
, it is actually part of the optional feature called JSR 305. The most "popular" implementation available atm isspotbugs-annotations
.So the solution is clear:
(Real) Workaround
Add these lines to your
android/app/build.gradle
'sdependencies
section:implementation 'com.google.errorprone:error_prone_annotations:2.36.0' // required by flutter_secure_storage implementation 'com.github.spotbugs:spotbugs-annotations:4.8.6' // required by flutter_secure_storage
Replace the version codes with the most recent ones you find in the links above.
dependencies { implementation 'com.google.errorprone:error_prone_annotations:2.36.0' implementation 'com.github.spotbugs:spotbugs-annotations:4.8.6' }
For anyone caring about this issue: it is a really, really bad workaround to suppress all errors with
-dontwarn
.This error, which was a compile warning before AGP 8.0, has now been elevated to a compile error. Essentially, it is trying to tell you that some classes referenced in your project cannot be found.
In some cases, you can still ignore it completely using
-dontwarn
like you did before AGP 8.0; however, in most cases, you should find the missing classes rather than suppressing the error to avoid ignoring the underlying issues.Let's take a look at the missing classes in this issue:
For
com.google.errorprone.annotations.*
, it's clear that it is part of theerror_prone_annotations
package.For
javax.annotation.Nullable
, it is actually part of the optional feature called JSR 305. The most "popular" implementation available atm isspotbugs-annotations
.So the solution is clear:
(Real) Workaround
Add these lines to your
android/app/build.gradle
'sdependencies
section:implementation 'com.google.errorprone:error_prone_annotations:2.36.0' // required by flutter_secure_storage implementation 'com.github.spotbugs:spotbugs-annotations:4.8.6' // required by flutter_secure_storage
Replace the version codes with the most recent ones you find in the links above.
It's realy works for me. Thank you very much!
Steps to reproduce
flutter_secure_storage: ^9.2.2
todependencies
ofpubspec.yaml
android/settings.gradle
(com.android.application
plugin) or any other 8.x.y.android/gradle/wrapper/gradle-wrapper.properties
or any other which support the above specified AGP version.flutter build apk
orflutter run --release
).Expected behavior
Builds successfully
Actual behavior
Versions
Additional notes
android.enableR8.fullMode=false
toandroid/gradle.properties
doesn't help