Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/*.png from xml type xml resource ID #
See original GitHub issueI am trying to apply custom icon for the slider but getting following crash. The resource is available in drawable folder.
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/pointing_hand.png from xml type xml resource ID #0x7f0700ab
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1243)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2172)
at android.content.res.Resources.getXml(Resources.java:1221)
at com.ncorti.slidetoact.SlideToActView.parseVectorDrawableCompat(SlideToActView.kt:296)
2019-11-04 13:30:53.979 com.** E/AndroidRuntime: at com.ncorti.slidetoact.SlideToActView.<init>(SlideToActView.kt:271)
at com.ncorti.slidetoact.SlideToActView.<init>(SlideToActView.kt:40)
at com.ncorti.slidetoact.SlideToActView.<init>(Unknown Source:6)
... 40 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
at android.content.res.AssetManager.nativeOpenXmlAsset(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:1009)
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1227)
... 46 more
My xml:
<com.ncorti.slidetoact.SlideToActView
android:id="@+id/btn_swipe"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/home_screen"
android:layout_margin="30dp"
app:area_margin="0dp"
app:elevation="8dp"
app:slider_icon="@drawable/arrow_right"
app:inner_color="@color/colorAccent"
app:outer_color="@color/colorPrimary"
app:slider_height="64dp"
app:slider_locked="false"
app:rotate_icon="true"
app:text="SWIPE TO REFLECT"
app:text_color="@android:color/white"
app:text_size="16sp"
app:text_style="bold" />
Tesing device:
Samsung A30 - Android version: Pie 9
Library Version:
implementation 'com.ncorti:slidetoact:0.7.0'
Full stacktrace:
2019-11-04 13:47:16.887 com.** E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.***, PID: 27796
android.view.InflateException: Binary XML file line #41: Binary XML file line #41: Error inflating class com.ncorti.slidetoact.SlideToActView
Caused by: android.view.InflateException: Binary XML file line #41: Error inflating class com.ncorti.slidetoact.SlideToActView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
at android.view.LayoutInflater.createView(LayoutInflater.java:686)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:829)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:769)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:902)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:863)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:905)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:863)
at android.view.LayoutInflater.inflate(LayoutInflater.java:554)
at android.view.LayoutInflater.inflate(LayoutInflater.java:461)
at com.**.general.HomeFragment.onCreateView(HomeFragment.java:49)
at androidx.fragment.app.Fragment.performCreateView(Fragment.java:2600)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:881)
at androidx.fragment.app.FragmentManagerImpl.moveFragmentToExpectedState(FragmentManagerImpl.java:1238)
at androidx.fragment.app.FragmentManagerImpl.moveToState(FragmentManagerImpl.java:1303)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:439)
at androidx.fragment.app.FragmentManagerImpl.executeOps(FragmentManagerImpl.java:2079)
at androidx.fragment.app.FragmentManagerImpl.executeOpsTogether(FragmentManagerImpl.java:1869)
at androidx.fragment.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(FragmentManagerImpl.java:1824)
at androidx.fragment.app.FragmentManagerImpl.execPendingActions(FragmentManagerImpl.java:1727)
at androidx.fragment.app.FragmentManagerImpl.dispatchStateChange(FragmentManagerImpl.java:2663)
at androidx.fragment.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManagerImpl.java:2613)
at androidx.fragment.app.FragmentController.dispatchActivityCreated(FragmentController.java:246)
at androidx.fragment.app.FragmentActivity.onStart(FragmentActivity.java:542)
at androidx.appcompat.app.AppCompatActivity.onStart(AppCompatActivity.java:201)
at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1395)
at android.app.Activity.performStart(Activity.java:7348)
at android.app.ActivityThread.handleStartActivity(ActivityThread.java:3147)
at android.app.servertransaction.TransactionExecutor.performLifecycleSequence(TransactionExecutor.java:180)
at android.app.servertransaction.TransactionExecutor.cycleToPath(TransactionExecutor.java:165)
at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:142)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1957)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:214)
at android.app.ActivityThread.main(ActivityThread.java:7099)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:494)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:965)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable-xxhdpi-v4/arrow_right.png from xml type xml resource ID #0x7f07005e
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1243)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2172)
at android.content.res.Resources.getXml(Resources.java:1221)
at com.ncorti.slidetoact.SlideToActView.parseVectorDrawableCompat(SlideToActView.kt:332)
2019-11-04 13:47:16.888 com.** E/AndroidRuntime: at com.ncorti.slidetoact.SlideToActView.<init>(SlideToActView.kt:306)
at com.ncorti.slidetoact.SlideToActView.<init>(SlideToActView.kt:39)
at com.ncorti.slidetoact.SlideToActView.<init>(Unknown Source:6)
... 40 more
Caused by: java.io.FileNotFoundException: Corrupt XML binary file
at android.content.res.AssetManager.nativeOpenXmlAsset(Native Method)
at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:1009)
at android.content.res.ResourcesImpl.loadXmlResourceParser(ResourcesImpl.java:1227)
... 46 more
Gradle:
compileSdkVersion 29
defaultConfig {
applicationId "com.***.**"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
Please let me know if you need more details. Thanks for your support.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
android - Resources$NotFoundException: File res/drawable ...
Since this page is the first result of google android.content.res. ... I want to share that this exception might caused by your foo.xml...
Read more >App resources overview - Android Developers
This document shows you how to group your resources in your Android project and provide alternative resources for specific device configurations ...
Read more >"Corrupt XML binary file" error when adding a PNG to res ...
To solve "android.content.res.Resources$NotFoundException: Resource ID ..." Exception you may want to create a folder called "drawable" under res folder and ...
Read more >Android.Content.Res.Resources+NotFoundException
Right-click your xml file in Android project, try to check if the Build Action is AndroidResource, then clean the solution, remove bin/obj ...
Read more >android.content.res.Resources$NotFoundException: File res ...
应该可能是相关的drawable文件夾下没有图片资源,还有可能在编码时不小把图片的命名和drawable下xml文件的名字相同了。 android可以区分xml和png文件, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @itabdullah @emmelybl Can you please provide more details on the drawable that you’re using? Are you using a PNG file? Can you please use a vector drawable and confirm that the crash is still happening?
Yes, that’s the intended behavior. Thanks for verifying