简体   繁体   中英

android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d

Can't load a layout, activity fails on: setContentView the "missing" resource is the activity layout itself found under layout folder Activity extends FragmentActivity the device: HTC M9 running marshmallow

stack trace:

  Exception: java.lang.RuntimeException: Unable to start activity ComponentInfo{MyActivty}: 
  android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
           at android.app.ActivityThread.access$900(ActivityThread.java:150)
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
           at android.os.Handler.dispatchMessage(Handler.java:102)
           at android.os.Looper.loop(Looper.java:168)
           at android.app.ActivityThread.main(ActivityThread.java:5845)
           at java.lang.reflect.Method.invoke(Native Method)
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
        Caused by: android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
           at android.content.res.Resources.loadXmlResourceParser(Resources.java:2836)
           at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
           at android.content.res.Resources.getLayout(Resources.java:1173)
           at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
           at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
           at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
           at android.app.Activity.setContentView(Activity.java:2177)
           at packageName.MyActivty.onCreate(MyActivty.java:43)
           at android.app.Activity.performCreate(Activity.java:6248)
           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
           at android.app.ActivityThread.access$900(ActivityThread.java:150) 
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
           at android.os.Handler.dispatchMessage(Handler.java:102) 
           at android.os.Looper.loop(Looper.java:168) 
           at android.app.ActivityThread.main(ActivityThread.java:5845) 
           at java.lang.reflect.Method.invoke(Native Method) 
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
        Caused by: java.io.FileNotFoundException: Share with %s
           at android.content.res.AssetManager.openXmlAssetNative(Native Method)
           at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:508)
           at android.content.res.Resources.loadXmlResourceParser(Resources.java:2818)
           at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791) 
           at android.content.res.Resources.getLayout(Resources.java:1173) 
           at android.view.LayoutInflater.inflate(LayoutInflater.java:421) 
           at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
           at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411) 
           at android.app.Activity.setContentView(Activity.java:2177) 
           at packageName.MyActivity.onCreate(MyActivty.java:43) 
           at android.app.Activity.performCreate(Activity.java:6248) 
           at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
           at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
           at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
           at android.app.ActivityThread.access$900(ActivityThread.java:150) 
           at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
           at android.os.Handler.dispatchMessage(Handler.java:102) 
           at android.os.Looper.loop(Looper.java:168) 
           at android.app.ActivityThread.main(ActivityThread.java:5845) 
           at java.lang.reflect.Method.invoke(Native Method) 
           at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
           at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
  12-24 17:43:16.037 10054-10054/com.deepinstinct.android.dev.debug E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.deepinstinct.android.dev.debug, PID: 10054
    java.lang.RuntimeException: Unable to start activity ComponentInfo{packageName/packageName.MyActivity}: 
    android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2484)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544)
        at android.app.ActivityThread.access$900(ActivityThread.java:150)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:168)
        at android.app.ActivityThread.main(ActivityThread.java:5845)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
     Caused by: android.content.res.Resources$NotFoundException: File Share with %s from xml type layout resource ID #0x7f0a001d
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2836)
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791)
        at android.content.res.Resources.getLayout(Resources.java:1173)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411)
        at android.app.Activity.setContentView(Activity.java:2177)
        at packageName.MyActivity.onCreate(MyActivity.java:43)
        at android.app.Activity.performCreate(Activity.java:6248)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
        at android.app.ActivityThread.access$900(ActivityThread.java:150) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:168) 
        at android.app.ActivityThread.main(ActivityThread.java:5845) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687) 
     Caused by: java.io.FileNotFoundException: Share with %s
        at android.content.res.AssetManager.openXmlAssetNative(Native Method)
        at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:508)
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2818)
        at android.content.res.Resources.loadXmlResourceParser(Resources.java:2791) 
        at android.content.res.Resources.getLayout(Resources.java:1173) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:421) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:411) 
        at android.app.Activity.setContentView(Activity.java:2177) 
        at packageName.MyActivity.onCreate(MyActivity.java:43) 
        at android.app.Activity.performCreate(Activity.java:6248) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1125) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2437) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2544) 
        at android.app.ActivityThread.access$900(ActivityThread.java:150) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1394) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:168) 
        at android.app.ActivityThread.main(ActivityThread.java:5845) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:797) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)

I have never seen this error: File Share with %s from xml type layout resource how can i fix this?

solved it:

I had an android library loaded to my project by reflection. the specified resource in the stack trace: 0x7f0a001d (my layout id) was a resource id of an appcompat component in the loaded library and the resources conflicted.

brute force solution: create a unique layout id for my layout that doesn't conflict with the loaded library's one (by copy-pasting the original layout). obviously not the best solution

actual solution that worked for me: the loaded library is all code and there is no native android functionality, so I have removed the appcompat v7 support library from the .gradle, making the conflicting resource to disappear

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM