8000 android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml · Issue #383 · flutter/gallery · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
This repository was archived by the owner on Jun 13, 2024. It is now read-only.
android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml  #383
Closed
@Megidd

Description

@Megidd

Describe the bug

Previously I was building and running fine. I don't remember making any change, but recently, I run into such errors while building and running the app on a Samsung Galaxy Note 3 through Android Studio:

Launching lib\main.dart on SM N900 in debug mode...
Running Gradle task 'assembleDebug'...
E/AndroidRuntime(12731): FATAL EXCEPTION: main
E/AndroidRuntime(12731): Process: io.flutter.demo.gallery, PID: 12731
E/AndroidRuntime(12731): java.lang.RuntimeException: Unable to start activity ComponentInfo{io.flutter.demo.gallery/io.flutter.demo.gallery.MainActivity}: android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml from drawable resource ID #0x7f040000
E/AndroidRuntime(12731): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2693)
E/AndroidRuntime(12731): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
E/AndroidRuntime(12731): 	at android.app.ActivityThread.access$900(ActivityThread.java:177)
E/AndroidRuntime(12731): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
E/AndroidRuntime(12731): 	at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(12731): 	at android.os.Looper.loop(Looper.java:145)
E/AndroidRuntime(12731): 	at android.app.ActivityThread.main(ActivityThread.java:5942)
E/AndroidRuntime(12731): 	at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(12731): 	at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime(12731): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
E/AndroidRuntime(12731): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
E/AndroidRuntime(12731): Caused by: android.content.res.Resources$NotFoundException: File res/drawable-v21/launch_background.xml from drawable resource ID #0x7f040000
E/AndroidRuntime(12731): 	at android.content.res.Resources.loadDrawableForCookie(Resources.java:3752)
E/AndroidRuntime(12731): 	at android.content.res.Resources.loadDrawable(Resources.java:3620)
E/AndroidRuntime(12731): 	at android.content.res.Resources.getDrawable(Resources.java:1852)
E/AndroidRuntime(12731): 	at android.content.res.Resources.getDrawable(Resources.java:1818)
E/AndroidRuntime(12731): 	at io.flutter.embedding.android.FlutterActivity.getSplashScreenFromManifest(FlutterActivity.java:495)
E/AndroidRuntime(12731): 	at io.flutter.embedding.android.FlutterActivity.provideSplashScreen(FlutterActivity.java:469)
E/AndroidRuntime(12731): 	at io.flutter.embedding.android.FlutterActivityAndFragmentDelegate.onCreateView(FlutterActivityAndFragmentDelegate.java:301)
E/AndroidRuntime(12731): 	at io.flutter.embedding.android.FlutterActivity.createFlutterView(FlutterActivity.java:520)
E/AndroidRuntime(12731): 	at io.flutter.embedding.android.FlutterActivity.onCreate(FlutterActivity.java:414)
E/AndroidRuntime(12731): 	at android.app.Activity.performCreate(Activity.java:6283)
E/AndroidRuntime(12731): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
E/AndroidRuntime(12731): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
E/AndroidRuntime(12731): 	... 10 more
E/AndroidRuntime(12731): Caused by: org.xmlpull.v1.XmlPullParserException: Binary XML file line #4: <item> tag requires a 'drawable' attribute or child tag defining a drawable
E/AndroidRuntime(12731): 	at android.graphics.drawable.LayerDrawable.inflateLayers(LayerDrawable.java:202)
E/AndroidRuntime(12731): 	at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:147)
E/AndroidRuntime(12731): 	at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1150)
E/AndroidRuntime(12731): 	at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1063)
E/AndroidRuntime(12731): 	at android.content.res.Resources.loadDrawableForCookie(Resources.java:3736)
E/AndroidRuntime(12731): 	... 21 more

Flutter doctor
Copy and paste the output of flutter doctor -v here

>flutter doctor -v
[√] Flutter (Channel master, 1.24.0-8.0.pre.1, on Microsoft Windows [Version 10.0.19041.264], locale en-US)
    • Flutter version 1.24.0-8.0.pre.1 at C:\Users\m3\repos\flutter
    • Framework revision e444b1e3fa (5 weeks ago), 2020-10-30 00:41:52 -0400
    • Engine revision 99cc50dfff
    • Dart version 2.11.0 (build 2.11.0-266.0.dev)

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.1)
    • Android SDK at C:\Users\m3\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin version 50.0.1
    • Dart plugin version 193.7547
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] Connected device (3 available)
    • SM N900 (mobile) • 4d00b6ae472d80eb • android-arm    • Android 5.0 (API 21)
    • Web Server (web) • web-server       • web-javascript • Flutter Tools
    • Chrome (web)     • chrome           • web-javascript • Google Chrome 87.0.4280.66

• No issues found!

To Reproduce
Steps to reproduce the behavior:

  1. Git checkout master branch
  2. Open Android Studio
  3. Connect your Android smartphone device to computer through USB port
  4. Click the green triangle to build and run the app on the device
  5. Error are thrown on terminal

Expected behavior
No error or exception is expected. The app should build and run fine on the device.

Screenshots

image

Desktop information:

  • OS: Windows 10
  • Browser Opera
  • Version:72.0.3815.400

Smartphone information:

  • Device: Samsung Galaxy Note 3
  • OS: Android 5.0
  • Browser Opera
  • Version 60.3.3004.55692

Additional context
Such posts show that maybe the Gradle build system needs to be configured differently, not sure:

https://stackoverflow.com/a/39419701/3405291

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0