Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error with latest flutter/agp versions #2139

Open
2 tasks done
holzgeist opened this issue May 14, 2024 · 12 comments
Open
2 tasks done

Build error with latest flutter/agp versions #2139

holzgeist opened this issue May 14, 2024 · 12 comments
Labels
bug Something isn't working

Comments

@holzgeist
Copy link

holzgeist commented May 14, 2024

  • I have read the Getting Started section
  • I have already searched for the same problem

Environment

Technology Version
Flutter version 3.22
Plugin version 1.0.13
Android version 14
iOS version --
macOS version --
Xcode version --
Google Chrome version --
Android Gradle Plugin 8.4.0

Device information: irrelevant, as this is a build error

Description

Expected behavior:

Be able to compile an app on Android using this plugin with obfuscation/minification

Current behavior:

Build error during minification:

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in .../build/flutter_inappwebview_android/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class android.window.BackEvent (referenced from: void io.flutter.embedding.android.FlutterActivity.startBackGesture(android.window.BackEvent) and 3 other contexts)

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_inappwebview_android:minifyReleaseWithR8'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
   > Compilation failed to complete

Steps to reproduce

  1. Depend on flutter_inappwebview
  2. Upgrade to latest flutter/AGP/...
  3. Do a release build with minification (e.g. flutter build apk --obfuscate --split-debug-info /tmp/debug-info. Alternatively, skip --obfuscate --split-debug-info ... and set minifyEnabled true in android/app/build.gradle
@holzgeist holzgeist added the bug Something isn't working label May 14, 2024
Copy link

👋 @holzgeist

NOTE: This comment is auto-generated.

Are you sure you have already searched for the same problem?

Some people open new issues but they didn't search for something similar or for the same issue. Please, search for it using the GitHub issue search box or on the official inappwebview.dev website, or, also, using Google, StackOverflow, etc. before posting a new one. You may already find an answer to your problem!

If this is really a new issue, then thank you for raising it. I will investigate it and get back to you as soon as possible. Please, make sure you have given me as much context as possible! Also, if you didn't already, post a code example that can replicate this issue.

In the meantime, you can already search for some possible solutions online! Because this plugin uses native WebView, you can search online for the same issue adding android WebView [MY ERROR HERE] or ios WKWebView [MY ERROR HERE] keywords.

Following these steps can save you, me, and other people a lot of time, thanks!

@komaxx
Copy link

komaxx commented May 15, 2024

It would be great if the according PR could be merged quickly, as this currently blocks us (and probably other devs as well) from building releases, and downgrading to an earlier version is quite cumbersome as the API has changed in between.

@Augustinekan
Copy link

It would be great if the according PR could be merged quickly, as this currently blocks us (and probably other devs as well) from building releases, and downgrading to an earlier version is quite cumbersome as the API has changed in between.

Any luck pointing your dependency to the pull request? it doesn't work on my side

@komaxx
Copy link

komaxx commented May 15, 2024

Ah, good point!
Got it to run with:

dependency_overrides:
  # TODO: Recheck once flutter_inappwebview version >6.0.0 is released
  flutter_inappwebview_android:
    git:
      url: https://github.com/holzgeist/flutter_inappwebview
      path: flutter_inappwebview_android
      ref: d89b1d32638b49dfc58c4b7c84153be0c269d057

@holzgeist
Copy link
Author

I closed the according PR because it was a duplicate of #2102

@flechajm
Copy link

Ah, good point! Got it to run with:

dependency_overrides:
  # TODO: Recheck once flutter_inappwebview version >6.0.0 is released
  flutter_inappwebview_android:
    git:
      url: https://github.com/holzgeist/flutter_inappwebview
      path: flutter_inappwebview_android
      ref: d89b1d32638b49dfc58c4b7c84153be0c269d057

You saved my deploy today. Thank you so much!

@specOper99
Copy link

specOper99 commented May 19, 2024

Still having an issue even afetr depending on holzgeist repo

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/username/Desktop/projectname/build/app/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class com.google.j2objc.annotations.ReflectionSupport$Level (referenced from: com.google.common.util.concurrent.AbstractFuture)
Missing class com.google.j2objc.annotations.ReflectionSupport (referenced from: com.google.common.util.concurrent.AbstractFuture)
Missing class com.google.j2objc.annotations.RetainedWith (referenced from: com.google.common.collect.ImmutableSet com.google.common.collect.ImmutableMap.entrySet 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

@Yohan-J
Copy link

Yohan-J commented May 20, 2024

Still having an issue even afetr depending on holzgeist repo

ERROR: Missing classes detected while running R8. Please add the missing classes or apply additional keep rules that are generated in /Users/username/Desktop/projectname/build/app/outputs/mapping/release/missing_rules.txt.
ERROR: R8: Missing class com.google.j2objc.annotations.ReflectionSupport$Level (referenced from: com.google.common.util.concurrent.AbstractFuture)
Missing class com.google.j2objc.annotations.ReflectionSupport (referenced from: com.google.common.util.concurrent.AbstractFuture)
Missing class com.google.j2objc.annotations.RetainedWith (referenced from: com.google.common.collect.ImmutableSet com.google.common.collect.ImmutableMap.entrySet 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

@specOper99 - looks like your issue is not linked to flutter_inappwebview, but that fact that your proguard.pro file is not there.
check if you have the proguard-rules.pro file in your project (android/app/). if not create one and then add the following lines

-ignorewarnings
-keep class * {
public private *;
}

@nayanbabariya
Copy link

@Yohan-J You have an issue with Proguard but it's a different one. check the actual issue here.

  • Actual issue is about the R8: Missing class android.window.BackEvent and your issue is R8: Missing class com.google.j2objc.annotations.ReflectionSupport$Level that is from a different thing.

@Yohan-J
Copy link

Yohan-J commented May 20, 2024

@nayanbabariya yes, this wasn't my issue, but i was also replying to the comment above mine, stating that his issue was something else.

@nayanbabariya
Copy link

@Yohan-J Okay. but the mentioned issue is from the flutter_inappwebview plugin.

@specOper99
Copy link

@Yohan-J Thank you for your answer.
Actually I noticed that lately (before few hours) that the problem is not related to flutter_inappwebview but it is related to awesome_notification
if somebody is having it then can try to downgrade in order to be able to build cause whenever I try to ignore the warns it never changes its behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants