When a flutter fragment is embedded in a native Android application, the rendering of the fragment seems incorrect when it is being scrolled off its parent view.
As you can see the fragment draws over the taskbar, as well as the status bar. (When the fragment is the last item in the list, the button bar is also drawn over in a similar way.)
I have created a repository where this behavior can be reproduced. It is quite straightforward: One of the startup samples of Android, embedding a simple Flutter module. The flutter fragment is inside a CardView that is inside a normal Android ScrollView.
flutter doctor -v output:
• Flutter version 3.0.5 at /home/djh/snap/flutter/common/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision f1875d570e (4 weeks ago), 2022-07-13 11:24:16 -0700
• Engine revision e85ea0e79c
• Dart version 2.17.6
• DevTools version 2.12.2
[!] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
• Android SDK at /home/djh/Android/Sdk
• Platform android-32, build-tools 32.1.0-rc1
✗ Android SDK file not found: /home/djh/Android/Sdk/build-tools/32.1.0-rc1/aapt.
• Try re-installing or updating your Android SDK,
visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
• cmake version 3.10.2
• ninja version 1.8.2
• pkg-config version 0.29.1
[✓] Android Studio (version 2021.2)
• Android Studio at /snap/android-studio/123/android-studio
• Flutter plugin version 67.1.2
• Dart plugin version 212.5744
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] Android Studio
• Android Studio at /snap/android-studio/current/android-studio/
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• android-studio-dir = /snap/android-studio/current/android-studio/
• Java version OpenJDK Runtime Environment (build 11.0.12+0-b1504.28-7817840)
[✓] VS Code
• VS Code at /snap/code/current
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (3 available)
• sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64 • Android 12 (API 31) (emulator)
• Linux (desktop) • linux • linux-x64 • Ubuntu 18.04.6 LTS 5.4.0-122-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 103.0.5060.134
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
Any ideas of how to set the expected rendering for the flutter fragment?
A workaround seems to be to set the transparency of the flutter fragment to opaque. So call:
FlutterFragment.withNewEngine()
.transparencyMode(TransparencyMode.opaque)
.build();
when embedding it.
This does fix the scrolling behavior, but sometimes shows a black block, when switching between items on the nav bar.
Any other ways of addressing the scroll behavior?
Related
I have set the icon change dynamically in my app. Icon switching is set with an activity-alias (as described in the Android documentation). After changing the icon, and then changing the activity, login with Facebook no longer works with error "Log in attempt failed: FacebookActivity could not be started. Please make sure you added FacebookActivity to the AndroidManifest". My AndroidManifest.xml is configured as Facebook's documentation. Do you have any ideas? Thank you.
PS. The code I'm using right now is just a test project but partially replicating what's configured in my main project :)
Change Icon and Facebook login functions
My AndroidManifest.xml
flutter doctor -v
[✓] Flutter (Channel stable, 3.3.8, on macOS 13.0.1 22A400 darwin-x64, locale it-IT)
• Flutter version 3.3.8 on channel stable at /Users/wiwo/fvm/versions/3.3.8
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (4 settimane fa), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at /Users/Wiwo/Library/Android/sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 14.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14B47b
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.2.3)
• IntelliJ at /Applications/IntelliJ IDEA.app
• Flutter plugin version 71.0.5
• Dart plugin version 222.4345.14
[✓] VS Code (version 1.73.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.54.0
[✓] Connected device (4 available)
• ONEPLUS A6003 (mobile) • 192.168.178.110:5555 • android-arm64 • Android 11 (API 30)
• iPhone di Silvio (mobile) • 00008101-00126D1821E3003A • ios • iOS 16.2 20C5049e
• macOS (desktop) • macos • darwin-x64 • macOS 13.0.1 22A400 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 108.0.5359.94
! Error: iPhone di Silvio is busy: Fetching debug symbols for iPhone di Silvio. Xcode will continue when iPhone di Silvio is finished. (code -10)
! Error: Apple Watch di Silvio needs to connect to determine its availability. Check the connection between the device and its companion iPhone, and the connection between the iPhone and Xcode. Both devices may also need to be restarted and unlocked. (code 1)
[✓] HTTP Host Availability
• All required HTTP hosts are available
• No issues found!
I expect the activity to be found even when I am an activity-alias
I tried to run my project from laptop, and have ancounted to problem.
What went wrong:
A problem occurred configuring root project 'android'.
Could not load compiled classes for build file 'C:\programming\projects\flutter\android\build.gradle' from cache.
I also use firebase and library flutter_background_geolocation 4.8.3
Flutter doctor -v
[√] Flutter (Channel stable, 3.3.8, on Microsoft Windows [Version 10.0.19044.2251], locale ru-RU)
• Flutter version 3.3.8 on channel stable at C:\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 52b3dc25f6 (2 days ago), 2022-11-09 12:09:26 +0800
• Engine revision 857bd6b74c
• Dart version 2.18.4
• DevTools version 2.15.0
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
• Android SDK at C:\Users\user\AppData\Local\Android\sdk
• Platform android-33, build-tools 33.0.0
• Java binary at: C:\Program Files\Android\Android Studio1\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[X] Visual Studio - develop for Windows
X Visual Studio not installed; this is necessary for Windows development.
Download at https://visualstudio.microsoft.com/downloads/.
Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
[√] VS Code (version 1.70.2)
• VS Code at C:\Users\user\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.52.0
[√] Connected device (4 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.19044.2251]
• Chrome (web) • chrome • web-javascript • Google Chrome 107.0.5304.107
• Edge (web) • edge • web-javascript • Microsoft Edge 107.0.1418.35
[√] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
i show only error message.
What i can do to fix this problem ?
I already tried to flutter clean, flutter pub cache repair, restart laptop, reinstall android studio, and reinstall android emulator.
I'm currently making an app for Android with Flutter, and I'm using google-mobile-ads package to show banner ads.
My environment is VScode & Android emurator by Android Studio.
To run this project Execute this command:
$ flutter run --no-sound-null-safety
Not with Play button.
However if I run with this command, hot reload is disabled. Any edits don't make any changes.
flutter doctor -v;
[√] Flutter (Channel beta, 2.6.0-5.2.pre, on Microsoft Windows [Version 10.0.22000.282], locale ja-JP)
• Flutter version 2.6.0-5.2.pre at D:\src\flutter_windows_2.5.0-stable\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 400608f101 (8 weeks ago), 2021-09-15 15:50:26 -0700
• Engine revision 1d521d89d8
• Dart version 2.15.0 (build 2.15.0-82.2.beta)
[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at D:\Android
• Platform android-30, build-tools 29.0.3
• Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe
[√] Android Studio (version 4.2)
• Android Studio at D:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
[√] VS Code (version 1.62.0)
• VS Code at C:\Users\yukik\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.28.0
[√] Connected device (3 available)
• Android SDK built for x86 (mobile) • emulator-5554 • android-x86 • Android 10 (API 29) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 95.0.4638.69
• Edge (web) • edge • web-javascript • Microsoft Edge 95.0.1020.44
• No issues found!
How can I make this possible?
When using flutter run you should be able to hot reload pressing r and to hot restart using R. Just press them in the terminal where you've used flutter run.
If I remember correctly, launching flutter run you should get all these info on the console as a message when starting!
Flutter Doctor -v indicates SDK is there.
(for some reason it says Android Studio is not installed)
**[√] Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
• Flutter version 2.2.0 at C:\Users\kaste\Documents\flutter
• Framework revision b22742018b (3 weeks ago), 2021-05-14 19:12:57 -0700
• Engine revision a9d88a4d18
• Dart version 2.13.0
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\kaste\AppData\Local\Android\Sdk
• Platform android-30, build-tools 30.0.3
• ANDROID_HOME = C:\Users\kaste\AppData\Local\Android\Sdk
• Java binary at: C:\Program Files\Common Files\Oracle\Java\javapath\java.exe
• Java version Java(TM) SE Runtime Environment 18.9 (build 11.0.10+8-LTS-162)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] VS Code (version 1.56.2)
• VS Code at C:\Users\kaste\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.22.0
[√] Connected device (3 available)
• sdk gphone x86 (mobile) • emulator-5554 • android-x86 • Android 11 (API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 90.0.4430.212
• Edge (web) • edge • web-javascript • Microsoft Edge 91.0.864.37**
In Android Studio, I get this error message when trying to start a new Flutter App.
Android Studio error message
I can't figure out why it's not working. I can run the default Android Studio flutter app in the Android Virtual Device fine.
?
same thing happened to me when i pointed the path
as
/home/ekele/flutter_sdk/bin
it worked when i changed it to
/home/pompidou/flutter_sdk
change the path below to C:\Users\kaste\Documents\flutter
As said before, you need to set 'flutter installation directory' (you got it as can be shown at your flutter doctor -v command output:
Flutter version 2.2.0 at C:\Users\kaste\Documents\flutter.
Problem is you are setting as flutter SDK your Android SDK installation directory, which is wrong. You need to just set C:\Users\kaste\Documents\flutter instead of C:\Users\kaste\AppData\Local\Android\sdk
I met a problem where when I build the application, it shows there is error where the package is not exists. I am using the example code that provided at pub dev of the dependency flutter_secure_storage. I have already change the minSdkVersion to 18.
Can I know is there any ways to fix this problem?
android\app\src\main\java\io\flutter\plugins\GeneratedPluginRegistrant.java:16: error: package com.it_nomads.fluttersecurestorage does not exist
flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin());
^
1 error
My flutter doctor -v
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.18363.1440], locale en-MY)
• Flutter version 2.2.1 at C:\Users\nurfa\flutter
• Framework revision 02c026b03c (6 days ago), 2021-05-27 12:24:44 -0700
• Engine revision 0fdb562ac8
• Dart version 2.13.1
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\nurfa\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\ProgramData\Oracle\Java\javapath\java.exe
• Java version Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
• All Android licenses accepted.
[√] Chrome - develop for the web
• Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).
[√] IntelliJ IDEA Community Edition (version 2021.1)
• IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2021.1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
[√] VS Code (version 1.56.2)
• VS Code at C:\Users\nurfa\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.23.0
[√] Connected device (3 available)
• COR L29 (mobile) • XTX7N18B29009354 • android-arm64 • Android 9 (API 28)
• Chrome (web) • chrome • web-javascript • Google Chrome 91.0.4472.77
• Edge (web) • edge • web-javascript • Microsoft Edge 90.0.818.51
after some search through Google, I have found a solution for my issue through Github. It could be some problem in the pub-cache folder. I follow the comment from one post in Github and deleted flutter_secure_storage inside the pub-cache folder and reinstall and it won't show the error anymore.
https://github.com/OneSignal/OneSignal-Flutter-SDK/issues/127#issuecomment-522273569