flutter_inappwebview icon indicating copy to clipboard operation
flutter_inappwebview copied to clipboard

Build failed on Android Target SDK 33

Open Dararii opened this issue 2 years ago • 38 comments

Environment

Technology Version
Flutter version 3.0.2
Plugin version 5.4.3+7
Android version API 33
iOS version Not Tested on iOS
Xcode version -

Device information:

Description

Break when target build version changed to 33 (Tiramisu on Android) Expected behavior: Build Complete Current behavior: Build Failed

Steps to reproduce

Nothing special to do. My project was able to build on targetSDK 32, but failed on targetSDK 33.

  1. Create a simple project, set target SDK and compile SDK version to 33 in Android setting.
  2. Depend on this library.

Images

Stacktrace/Logcat

Launching lib/main.dart on sdk gphone64 arm64 in debug mode... /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:280: error: cannot find symbol settings.setAppCachePath(options.appCachePath); ^ symbol: method setAppCachePath(String)

location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:494: error: cannot find symbol settings.setAppCacheEnabled(false); ^ symbol: method setAppCacheEnabled(boolean) location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:504: error: cannot find symbol settings.setAppCacheEnabled(true); ^ symbol: method setAppCacheEnabled(boolean) location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:515: error: cannot find symbol settings.setAppCachePath(ctx.getCacheDir().getAbsolutePath()); ^ symbol: method setAppCachePath(String) location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:517: error: cannot find symbol settings.setAppCacheEnabled(true); ^ symbol: method setAppCacheEnabled(boolean) location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:521: error: cannot find symbol settings.setAppCacheEnabled(false); ^ symbol: method setAppCacheEnabled(boolean) location: variable settings of type WebSettings /Users/dararii/Dev/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.4.3+7/android/src/main/java/com/pichillilorenzo/flutter_inappwebview/in_app_webview/InAppWebView.java:767: error: cannot find symbol settings.setAppCachePath(newOptions.appCachePath); ^ symbol: method setAppCachePath(String) location: variable settings of type WebSettings

Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 7 errors FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':flutter_inappwebview:compileDebugJavaWithJavac'.

Compilation failed; see the compiler error output for details.

  • 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

BUILD FAILED in 27s Exception: Gradle task assembleDebug failed with exit code 1 Exited

Dararii avatar Jun 16 '22 12:06 Dararii

đź‘‹ @Dararii

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!

github-actions[bot] avatar Jun 16 '22 12:06 github-actions[bot]

Need to downgrade targetSdkVersion and compileSdkVersion to 32 Also some other packages to older version, e.g: permission_handler: ^9.2.0

At least we can run our app until this issue fixed.

topex-psy avatar Jun 17 '22 10:06 topex-psy

same issue

cvphat avatar Jun 17 '22 10:06 cvphat

same issue

nastaran-mohammadi avatar Jun 20 '22 09:06 nastaran-mohammadi

i also have the same problem

MTM-A avatar Jun 22 '22 15:06 MTM-A

same here with Flutter 3.0.3

leopi99 avatar Jun 23 '22 17:06 leopi99

any fix?

vytautas-pranskunas- avatar Jun 25 '22 11:06 vytautas-pranskunas-

Same issue in flutter 3.0.3 and Dart 2.17.5

muktadirsonyy911 avatar Jun 27 '22 05:06 muktadirsonyy911

the solution can be downgrading the API level to 32. It worked for me

ahmetbesli avatar Jun 30 '22 20:06 ahmetbesli

Sadly I have other dependencies that require me to compile for / target API level 33... hope this can be sorted out soon.

apparatchiki avatar Jun 30 '22 22:06 apparatchiki

According to my project:

  1. CompileSdkVersion to 32
  2. Packages: permission_handler: ^9.2.0

Now I am able to open my App....

bzamanbd avatar Jul 02 '22 09:07 bzamanbd

Sadly I have other dependencies that require me to compile for / target API level 33... hope this can be sorted out soon.

I encountered the same problem, but after I upgraded Android studio (2021.2.1 patch 1) and gradle (7.3.3), I can set targetsdkversion 33 and compilesdkversion 33, and flutter build apk successful.

linpengteng avatar Jul 06 '22 06:07 linpengteng

Please solve this issue I am too facing it

venky9885 avatar Jul 08 '22 10:07 venky9885

Same here in android native with targetsdkversion 33 and compilesdkversion 33. Anyone who fixed this issue please reply to me soon. I really appreciate any help you can provide.

settings.setAppCacheEnabled(true);
            ^

symbol: method setAppCacheEnabled(boolean) location: variable settings of type WebSettings

nguyenhuuduc458 avatar Jul 12 '22 03:07 nguyenhuuduc458

For android getting same issue @pichillilorenzo please solve it ASAP we cant able to build app bundle

venky9885 avatar Jul 12 '22 03:07 venky9885

https://developer.android.com/sdk/api_diff/33/changes

Removed Methods

void setAppCacheEnabled(boolean) |   void setAppCacheMaxSize(long) |   void setAppCachePath(String)

Not sure what the resolution will be

rukshanuddin avatar Jul 13 '22 19:07 rukshanuddin

Need to downgrade targetSdkVersion and compileSdkVersion to 32 Also some other packages to older version, e.g: permission_handler: ^9.2.0

At least we can run our app until this issue fixed.

Getting this issue when using this plugin html_editor_enhanced which uses flutter_inappwebview.

Wont be able to downgrade to 32, already at flutter 3.0.5. Works flawlessly in Web, real pain is in compiling for Android

rshrc avatar Jul 18 '22 09:07 rshrc

Hi Guys! So I did a temp fix for people who still have an issue with this Android 33 SDK version.

dependency_overrides:
  flutter_inappwebview:
    git:
      url: https://github.com/rshrc/flutter_inappwebview
      ref: master

Add this to your pubspec.yaml. The temp fix we ran through our production web app, didn't seem to cause any crashes or problems. Helped compile the apps properly in Android SDK 33 with flutter 3.0.5. Hope this helps for a while!

rshrc avatar Jul 25 '22 10:07 rshrc

I am also getting the same errors with version 5.4.3+7 of flutter_inappwebview. Since it is not possible for me to downgrade to API version 32 and we don't want to include a fork of this project into ours, it would be nice if this issue could be solved soon.

manuwehmeier avatar Aug 08 '22 08:08 manuwehmeier

@pichillilorenzo @rshrc's fork seems to be working fine, can you please look into the changes and maybe a PR can be made and accepted? It is a pain to include forks as dependencies and then switch back to the original at later point keeping an eye on updates.

srihari9n avatar Aug 10 '22 04:08 srihari9n

I got the same issue. please fix it.

huylethanh avatar Aug 17 '22 03:08 huylethanh

Hi Guys! So I did a temp fix for people who still have an issue with this Android 33 SDK version.

dependency_overrides:
  flutter_inappwebview:
    git:
      url: https://github.com/rshrc/flutter_inappwebview
      ref: master

Add this to your pubspec.yaml. The temp fix we ran through our production web app, didn't seem to cause any crashes or problems. Helped compile the apps properly in Android SDK 33 with flutter 3.0.5. Hope this helps for a while!

PS D:\Code\customer main branch\Multivendor-Startt-From-2.0.4-> flutter pub get Because youtube_player_flutter 8.1.0 depends on flutter_inappwebview ^5.4.3+7 and no versions of youtube_player_flutter match >8.1.0 <9.0.0, youtube_player_flutter ^8.1.0 requires flutter_inappwebview from hosted. So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed. Running "flutter pub get" in Multivendor-Startt-From-2.0.4-...
pub get failed (1; So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed.)

facing this issue when add this dependency in pubspect.ymal file

vijayvaghela72 avatar Aug 17 '22 04:08 vijayvaghela72

Hi Guys! So I did a temp fix for people who still have an issue with this Android 33 SDK version.

dependency_overrides:
  flutter_inappwebview:
    git:
      url: https://github.com/rshrc/flutter_inappwebview
      ref: master

Add this to your pubspec.yaml. The temp fix we ran through our production web app, didn't seem to cause any crashes or problems. Helped compile the apps properly in Android SDK 33 with flutter 3.0.5. Hope this helps for a while!

PS D:\Code\customer main branch\Multivendor-Startt-From-2.0.4-> flutter pub get Because youtube_player_flutter 8.1.0 depends on flutter_inappwebview ^5.4.3+7 and no versions of youtube_player_flutter match >8.1.0 <9.0.0, youtube_player_flutter ^8.1.0 requires flutter_inappwebview from hosted. So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed. Running "flutter pub get" in Multivendor-Startt-From-2.0.4-... pub get failed (1; So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed.)

facing this issue when add this dependency in pubspect.ymal file

Seems like you used the git repo in the dependency: key, need to use it in dependency_overrides.Share your pubspec.yaml once.

rshrc avatar Aug 17 '22 05:08 rshrc

Any new solution for this problem? I have tried above methods I cannot downgrade sdk version from 33 because system is specifying compilesdk version to be 33 and @rshrc solution gave me a lot of another errors.

mehaknexever avatar Aug 18 '22 03:08 mehaknexever

Hi Guys! So I did a temp fix for people who still have an issue with this Android 33 SDK version.

dependency_overrides:
  flutter_inappwebview:
    git:
      url: https://github.com/rshrc/flutter_inappwebview
      ref: master

Add this to your pubspec.yaml. The temp fix we ran through our production web app, didn't seem to cause any crashes or problems. Helped compile the apps properly in Android SDK 33 with flutter 3.0.5. Hope this helps for a while!

PS D:\Code\customer main branch\Multivendor-Startt-From-2.0.4-> flutter pub get Because youtube_player_flutter 8.1.0 depends on flutter_inappwebview ^5.4.3+7 and no versions of youtube_player_flutter match >8.1.0 <9.0.0, youtube_player_flutter ^8.1.0 requires flutter_inappwebview from hosted. So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed. Running "flutter pub get" in Multivendor-Startt-From-2.0.4-... pub get failed (1; So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed.) facing this issue when add this dependency in pubspect.ymal file

Seems like you used the git repo in the dependency: key, need to use it in dependency_overrides.Share your pubspec.yaml once.

name: eshop_multivendor description: eShop Multivendor App

publish_to: 'none'

version: 1.0.0+4

environment: sdk: ">=2.15.1 <3.0.0"

dependencies: flutter: sdk: flutter

cupertino_icons: ^1.0.4 http: ^0.13.4 shared_preferences: ^2.0.15 connectivity: ^3.0.6 jaguar_jwt: ^3.0.0 flutter_local_notifications: ^9.5.3+1 path_provider: ^2.0.10 firebase_messaging: ^11.4.1 flutter_rating_bar: ^4.0.1 photo_view: ^0.14.0 firebase_auth: ^3.3.19 sms_autofill: ^2.2.0 intl: ^0.17.0 country_code_picker: ^2.0.2 google_maps_flutter: ^2.1.6 geolocator: ^8.2.1 file_picker: ^4.6.1 shimmer: ^2.0.0 geocoding: ^2.0.2 razorpay_flutter: ^1.2.9 flutter_paystack: git: url: https://github.com/definitelyme/flutter_paystack.git ref: a4a33c3dd0a12f46d655a2e63d11e9f20ba82d01 flutter_html_to_pdf: ^0.7.0 permission_handler: ^9.2.0 in_app_review: ^2.0.4 firebase_dynamic_links: ^4.2.5 open_file: ^3.2.1 provider: ^6.0.3 share_plus: ^4.0.5 video_player: ^2.4.2 flutter_svg: ^0.23.0+1 paytm: ^3.0.1 youtube_player_flutter: ^8.1.0 package_info: ^2.0.2 url_launcher: ^6.1.2 sqflite: ^2.0.2 version: ^2.0.0 flutter_downloader: ^1.8.0+1 speech_to_text: ^5.5.0 tuple: ^2.0.0 cached_network_image: ^3.2.1 lottie: ^1.2.1 flutter_stripe: ^3.0.2 flutter_widget_from_html: ^0.8.5
flutter_html: ^2.2.1 google_sign_in: ^5.3.3

dev_dependencies: flutter_test: sdk: flutter flutter_localizations: sdk: flutter flutter_lints: ^2.0.1

flutter:

uses-material-design: true

assets: - assets/images/ - assets/images/RattingIcons/ - assets/animation/ - lib/Language/ - assets/eShop.db

fonts: - family: opensans fonts: - asset: assets/font/OpenSans-Regular.ttf - family: ubuntu fonts: - asset: assets/font/Ubuntu-Regular.ttf

vijayvaghela72 avatar Aug 22 '22 08:08 vijayvaghela72

Hi Guys! So I did a temp fix for people who still have an issue with this Android 33 SDK version.

dependency_overrides:
  flutter_inappwebview:
    git:
      url: https://github.com/rshrc/flutter_inappwebview
      ref: master

Add this to your pubspec.yaml. The temp fix we ran through our production web app, didn't seem to cause any crashes or problems. Helped compile the apps properly in Android SDK 33 with flutter 3.0.5. Hope this helps for a while!

PS D:\Code\customer main branch\Multivendor-Startt-From-2.0.4-> flutter pub get Because youtube_player_flutter 8.1.0 depends on flutter_inappwebview ^5.4.3+7 and no versions of youtube_player_flutter match >8.1.0 <9.0.0, youtube_player_flutter ^8.1.0 requires flutter_inappwebview from hosted. So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed. Running "flutter pub get" in Multivendor-Startt-From-2.0.4-... pub get failed (1; So, because eshop_multivendor depends on both youtube_player_flutter ^8.1.0 and flutter_inappwebview from git, version solving failed.) facing this issue when add this dependency in pubspect.ymal file

Seems like you used the git repo in the dependency: key, need to use it in dependency_overrides.Share your pubspec.yaml once.

i am not using this package any more but still getting this error , how can i resolve any solution ?

even i try above solution ,

also done flutter clean , pub , etc. but no luck there ,

vijayvaghela72 avatar Aug 22 '22 08:08 vijayvaghela72

delete pubspec.lock file and run flutter pub get again

or

run flutter pub cache repair

rshrc avatar Aug 22 '22 08:08 rshrc

delete pubspec.lock file and run flutter pub get again

or

run flutter pub cache repair yes i have done same ,

deleted pubspec.lock folder and also flutter pub cache repair , but there is no luck . still when i run pub get in pubspec.lock file it's show flutter_inappwebview: dependency: transitive description: name: flutter_inappwebview url: "https://pub.dartlang.org" source: hosted version: "5.4.3+7"

but i have not use this package in pubspect.ymal file ,

please help me if have any other solution because i am stucked here

vijayvaghela72 avatar Aug 22 '22 09:08 vijayvaghela72

even for this issue i have done flutter setup again , but still no luck .

but i don't know why i am getting this error even i don;t use this packages in my code now but still facing this issue .

please help me .,.!

vijayvaghela72 avatar Aug 22 '22 09:08 vijayvaghela72

@vijayvaghela72

"Transitive dependency" means your program depends on it, because of a dependency you have that depends on it.

To find out which of your dependencies uses which other dependency, you can run:

flutter pub deps

It will show you a dependency tree with version numbers. Check which package is using flutter_inappwebview and then remove that dependency too.

srihari9n avatar Aug 22 '22 09:08 srihari9n