You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
install google_fonts into flutter project, but will cause android build fail, web still working
Steps to reproduce:
1.Following the offical instruction on pub.dev https://pub.dev/packages/google_fonts/install, just add the package (flutter pub add google_fonts)
2. Debug run the app with a real/virtual device will cause gradle task 'assembleDebug' fail.
3. I cleared gradle cache and flutter pub cache then add google_fonts to a fresh official demo flutter project which is working. And issue will raise in same way.
4. I remove the package and re-run pub get then project working back to normal, so i can make sure google fonts package is the reason caused the issue.
From the log output, I found the issue was related to the path_provider_android cannot be resolved. this package is dependence of path_provider which is the dependence of google_fonts
My gradle setting (Only modified the minSdk to 23 for use firebase auth, rest setting is same as flutter default):
plugins {
id "com.android.application"
// START: FlutterFire Configuration
id 'com.google.gms.google-services'
// END: FlutterFire Configuration
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}
android {
namespace = "***"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "***"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 23
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}
buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}
}
flutter {
source = "../.."
}
pubspec.yml
name: dongnanhang_delft
description: "Flutter project for donnanhang delft"
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: ^3.5.3
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
firebase_core: ^3.6.0
cloud_firestore: ^5.4.4
firebase_storage: ^12.3.3
firebase_auth: ^5.3.1
salomon_bottom_bar: ^3.3.2
hooks_riverpod: ^2.5.4
flutter_hooks: ^0.20.5
riverpod_annotation: ^2.5.3
go_router: ^14.3.0
either_dart: ^1.0.0
google_fonts: ^6.2.1
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^4.0.0
riverpod_generator: ^2.4.3
build_runner: ^2.4.13
custom_lint: ^0.6.8
riverpod_lint: ^2.3.13
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
pubspec.lock file: (provider_path and provider_path_android was added due to install of google_fonts package)
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':path_provider_android:compileDebugJavaWithJavac'.
> Could not resolve all files for configuration ':path_provider_android:androidJdkImage'.
> Failed to transform core-for-system-modules.jar to match attributes {artifactType=_internal_android_jdk_image, org.gradle.libraryelements=jar, org.gradle.usage=java-runtime}.
The text was updated successfully, but these errors were encountered:
Add path_provider_android: 2.2.10 in pubspec to set dependence version manully can solve this issue, I will leave it open since maybe someone from google_fonts package team need to change the dependence so others won't meet the issue. The default version added by google_fonts package of path_provider_android is 2.2.12 which just updated, maybe it is the reason caused the issue. Don't know if i should report this to that package too.
Package
google_fonts
Existing issue?
What happened?
Expected vs actual result:
install google_fonts into flutter project, but will cause android build fail, web still working
Steps to reproduce:
1.Following the offical instruction on pub.dev https://pub.dev/packages/google_fonts/install, just add the package (flutter pub add google_fonts)
2. Debug run the app with a real/virtual device will cause gradle task 'assembleDebug' fail.
3. I cleared gradle cache and flutter pub cache then add google_fonts to a fresh official demo flutter project which is working. And issue will raise in same way.
4. I remove the package and re-run pub get then project working back to normal, so i can make sure google fonts package is the reason caused the issue.
From the log output, I found the issue was related to the
path_provider_android
cannot be resolved. this package is dependence ofpath_provider
which is the dependence ofgoogle_fonts
My gradle setting (Only modified the minSdk to 23 for use firebase auth, rest setting is same as flutter default):
pubspec.yml
pubspec.lock file: (provider_path and provider_path_android was added due to install of google_fonts package)
Relevant log output
The text was updated successfully, but these errors were encountered: