Closed sha3rawi33 closed 2 years ago
Perhaps due to X Android SDK file not found: D:\DEV\Android\Android_SDK\platforms\android-32\android.jar.
, can you try fixing that first?
I have a similar issue on my macbook (Apple Silicon). I can't build for macos, ios, android after I add google fonts to the pubspec.yaml
. Building for Chrome works fine even with google fonts.
I am not sure what caused the issue. All I know is that the project builds again once I remove google_fonts, and adding google_fonts to the pubspec.yaml file causes the problem to reoccur even if I'm not using google_fonts in my project.
Have you tried arch -x86_64 sudo gem install ffi
?
Yes I have tried that and it didn't help.
Flutter projects build just fine until I add google_fonts
to the pubspec.yaml
and then it won't compile even if I don't use google_fonts
in my dart code at all (i.e. I don't even import it).
Can you try flutter clean
and building with and without google_fonts
?
First I created a new flutter project that has the default counter app without any modifications. Then I ran flutter run -d macos
without google_fonts: ^3.0.1
in the dependencies of pubspec.yaml
. Everything runs fine.
If I do flutter run -d macos
with google_fonts: ^3.0.1
in the pubspec.yaml
, it fails to build with the error message I supplied. This behavior persists before and after running flutter clean
.
Once I remove google_fonts
from the pubspec.yaml
I can immediately build and run the project successfully again. I don't even need to run flutter clean
Flutter version is 3.0.2 if that is worth anything.
Weird... It would be helpful to get a stacktrace as described in:
D:\GitHub\scms_shaaban\android\gradlew.bat -Pverbose=true -Ptarget-platform=android-arm64 -Ptarget=D:\GitHub\scms_shaaban\lib\main.dart
-Pbase-application-name=android.app.Application -Pdart-defines=RkxVVFRFUl9XRUJfQVVUT19ERVRFQ1Q9dHJ1ZQ== -Pdart-obfuscation=false -Ptrack-widget-creation=true -Ptree-shake-icons=false -Pfilesystem-scheme=org-dartlang-root
assembleDebug
[+1102 ms] > Task :app:preBuild UP-TO-DATE
[ ] > Task :app:preDebugBuild UP-TO-DATE
[ ] > Task :app:mergeDebugNativeDebugMetadata NO-SOURCE
[+2199 ms] > Task :app:compileFlutterBuildDebug
[ +298 ms] > Task :app:compileFlutterBuildDebug FAILED
[ +1 ms] Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
[ ] You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
[ +1 ms] See https://docs.gradle.org/7.4/userguide/command_line_interface.html#sec:command_line_warnings
[ ] 1 actionable task: 1 executed
[ ] FAILURE: Build failed with an exception.
[ +3 ms] * Where:
[ ] Script 'D:\DEV\Android\Flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1156
[ ] * What went wrong:
[ ] Execution failed for task ':app:compileFlutterBuildDebug'.
[ ] > Process 'command 'D:\DEV\Android\Flutter\bin\flutter.bat'' finished with non-zero exit value 1
[ ] * Try:
[ +1 ms] > Run with --stacktrace option to get the stack trace.
[ +1 ms] > Run with --info or --debug option to get more log output.
[ +1 ms] > Run with --scan to get full insights.
Okay, so since I'm building for macOS, there is no gradlew involved and I cannot find the instructions for getting a stack trace in the output of flutter run -d macos --verbose
(used the find operation). However, I did capture the output of flutter run -d macos --verbose
so you can examine it yourself and see if there is anything of interest there. It's pretty huge (5k lines), but I've included it all, just because I don't know if some of the things I would consider unimportant (like package version resolution) may end up being important information somewhere in the process of resolving this issue.
Here is the file: google_fonts_bug_verbose_project_build.txt
Given the crash, /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000104618000 ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
, I would take a look at https://stackoverflow.com/questions/66644365/cocoapods-on-m1-apple-silicon-fails-with-ffi-wrong-architecture and other similar questions on StackOverflow. Since there's nothing actionable for this package, I'm closing this bug, but do let us know if you figure out how to solve the build issue.
Thanks for the link and thanks for the responses. It was helpful. In the end I solved the issue with your help, so hopefully this will help others too.
Like the OP of your stackoverflow post, I had seen the instruction sudo arch -x86_64 gem install ffi
before, and I had tried it, but building still didn't work. However my ruby install wasn't as borked as his, so I looked elsewhere (not wanting to forcefully remove and reinstall everything). Turns out I was missing a step, which I found in this stackoverflow answer.
First you need to run sudo arch -x86_64 gem install ffi
and then you have to cd into the macos and/or ios directory of your flutter project and run arch -x86_64 pod install
. After doing both of those in that order, I was able to succesfully build projects witih google_fonts
again, even different projects where I did not run arch -x86_64 pod install
in its macos or ios directory.
p.s. I'm not sure about closing this, because the original person to open the issue was using windows, so he may have a different issue than I have, but it's your call to make. He doesn't seem to be involved in the discussion anymore anyway.
Steps to Reproduce
just adding
google_fonts: ^3.0.1
to the projectpubspec.yaml
and then running any build-related tasks likeflutter run
orflutter build apk
-after pub get surely- is producing the issueat same time, removing
google_fonts: ^3.0.1
from the projectpubspec.yaml
and then pub get and run is working like charm !The error I get is:
Output of:
flutter run --verbose
Flutter analyze Output:
Flutter Doctor output: