ALEXANDER LOZANO
ALEXANDER LOZANO

Reputation: 2034

Error: unable to locate asset entry in pubspec.yaml: "assets/CupertinoIcons.ttf"

after upgrade android studio to 3.2.1 and flutter plugin, i can't run my app, i get the follow error:

Error: unable to locate asset entry in pubspec.yaml: "assets/CupertinoIcons.ttf".
Error building assets
flutter doctor -v
[√] Flutter (Channel dev, v0.10.1, on Microsoft Windows [Versión 10.0.17763.134], locale es-ES)
    • Flutter version 0.10.1 at c:\flutter
    • Framework revision 6a3ff018b1 (6 weeks ago), 2018-10-18 18:38:26 -0400
    • Engine revision 3860a43379
    • Dart version 2.1.0-dev.7.1.flutter-b99bcfd309

[√] Android toolchain - develop for Android devices (Android SDK 28.0.3)
    • Android SDK at C:\Users\Alex\AppData\Local\Android\sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)
    • All Android licenses accepted.

[√] Android Studio (version 3.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 31.1.1
    • Dart plugin version 181.5656
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1136-b06)

[√] Connected device (3 available)
    • ONE E1005                 • *****      • android-arm   • Android 7.1.2 (API 25)
    • MIX                       • *****      • android-arm64 • Android 8.0.0 (API 26)
    • Android SDK built for x86 • emulator-5554 • android-x86   • Android 8.1.0 (API 27) (emulator)

• No issues found!

this is my pubspec.yaml, i test this project in other machine a works, and i supposs that there is nothing wrong with the code.

name: flute_example
description: flute_example

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: ^0.1.2
  flute_music_player: ^0.0.6

dev_dependencies:
  flutter_test:
    sdk: flutter

flutter:

  uses-material-design: true

  assets:
   - assets/lady.jpeg
   - assets/music_record.jpeg

Upvotes: 2

Views: 7234

Answers (4)

Mohammed Ali
Mohammed Ali

Reputation: 1185

After a lot of hours with no reasonable solution, I decided to delete all the cupertino_icons folders inside the pub cache folder (that located in {flutter_installation_folder}\.pub-cache\hosted\pub.dartlang.org) and this ensures to redownload the plugin again after making Flutter clean command and re pub get the project, and it is solved like a charm! enter image description here

Upvotes: 1

Mark Grigoriev
Mark Grigoriev

Reputation: 11

Make sure your path is correct, maybe you miss - /lib. Final path looks like this: lib/assets/CupertinoIcons.ttf

Upvotes: 0

Devangi
Devangi

Reputation: 375

I have a solution for that. Please try below code.

If we add font in FontManifest.json file then font will apply in your code.

Here is a code,

FontManifest.json

[
 {
   "fonts": [
   {
     "asset": "fonts/MaterialIcons-Regular.ttf"
   }
],
   "family": "MaterialIcons"
},
   {
     "fonts": [
   {
      "asset": "fonts/MontserratSemiBold.ttf"
   }
 ],
   "family": "MontserratSemiBold"
 }
]

Above code solved my 2 Flutter web issues,

(1) Font rendering and

(2) Icon rendering

Hope It will help you also. :)

Upvotes: 0

Günter Zöchbauer
Günter Zöchbauer

Reputation: 657058

Look up cupertino_icons in the .packages file and delete the folder (without lib)

so if you have

cupertino_icons:file:///Users/myuser/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/lib/

then delete

cupertino_icons:file:///Users/myuser/.pub-cache/hosted/pub.dartlang.org/cupertino_icons-0.1.2/

and run flutter packages get again.

Upvotes: 2

Related Questions