Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 91519

resource not found in android

$
0
0

I'm getting this error in Android using Xamarin Forms. This exact same code works in a new project when I copy the code. It also works on iOS. In the error message Its trying to find what happens to be the first image in the Resources\drawable folder. I've made 1000% sure the image is in the folder. I've deleted and re-added the image. I've clean and rebuilt the project. The funny thing is on this page the code is not referencing any image

  10-23 15:05:07.512 I/MonoDroid(20054): UNHANDLED EXCEPTION:
10-23 15:05:07.622 I/MonoDroid(20054): Android.Content.Res.Resources+NotFoundException: Exception of type 'Android.Content.Res.Resources+NotFoundException' was thrown.
10-23 15:05:07.622 I/MonoDroid(20054): at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000b] in /Users/builder/data/lanes/2185/53fce373/source/mono/mcs/class/corlib/System.Runtime.ExceptionServices/ExceptionDispatchInfo.cs:61
10-23 15:05:07.627 I/MonoDroid(20054): at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue*) [0x00084] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/src/Runtime/JNIEnv.g.cs:1029
10-23 15:05:07.627 I/MonoDroid(20054): at Android.App.Activity.SetContentView (int) [0x00070] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:5872
10-23 15:05:07.627 I/MonoDroid(20054): at ZXing.Mobile.ZxingActivity.OnCreate (Android.OS.Bundle) <IL 0x0006a, 0x0032f>
10-23 15:05:07.627 I/MonoDroid(20054): at Android.App.Activity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) [0x00011] in /Users/builder/data/lanes/2185/53fce373/source/monodroid/src/Mono.Android/platforms/android-23/src/generated/Android.App.Activity.cs:2857
10-23 15:05:07.627 I/MonoDroid(20054): at (wrapper dynamic-method) object.1bdd6706-8cc7-4b65-8417-465ec1ea6a86 (intptr,intptr,intptr) <IL 0x00017, 0x00043>
10-23 15:05:07.627 I/MonoDroid(20054):   --- End of managed exception stack trace ---
10-23 15:05:07.627 I/MonoDroid(20054): android.content.res.Resources$NotFoundException: File res/drawable-hdpi-v4/defaultprofile.png from xml type layout resource ID #0x7f020000
10-23 15:05:07.627 I/MonoDroid(20054):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:3083)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:3030)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.content.res.Resources.getLayout(Resources.java:1722)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.view.LayoutInflater.inflate(LayoutInflater.java:395)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
10-23 15:05:07.627 I/MonoDroid(20054):  at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:360)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.Activity.setContentView(Activity.java:1932)
10-23 15:05:07.627 I/MonoDroid(20054):  at md5e1d4744ef128cd013cac92521f1a8e76.ZxingActivity.n_onCreate(Native Method)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.Activity.performCreate(Activity.java:5326)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1097)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2213)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2304)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.ActivityThread.access$700(ActivityThread.java:152)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1284)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.os.Handler.dispatchMessage(Handler.java:99)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.os.Looper.loop(Looper.java:176)
10-23 15:05:07.627 I/MonoDroid(20054):  at android.app.ActivityThread.main(ActivityThread.java:5299)
10-23 15:05:07.627 I/MonoDroid(20054):  at java.lang.reflect.Method.invokeNative(Native Method)
10-23 15:05:07.627 I/MonoDroid(20054):  at java.lang.reflect.Method.invoke(Method.java:511)
10-23 15:05:07.627 I/MonoDroid(20054):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
10-23 15:05:07.627 I/MonoDroid(20054):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
10-23 15:05:07.632 I/MonoDroid(20054):  at dalvik.system.NativeStart.main(Native Method)
10-23 15:05:07.632 I/MonoDroid(20054): Caused by: java.io.FileNotFoundException: Corrupt XML binary file
10-23 15:05:07.632 I/MonoDroid(20054):  at android.content.res.AssetManager.openXmlAssetNative(Native Method)
10-23 15:05:07.632 I/MonoDroid(20054):  at android.content.res.AssetManager.openXmlBlockAsset(AssetManager.java:487)
10-23 15:05:07.632 I/MonoDroid(20054):  at android.content.res.Resources.loadXmlResourceParser(Resources.java:3061)

Here's the code that causes the error. (as I said before, works on iOS, and on Android when the code is copied into a new project)

  BarCodeResult result = await BarCodes.Instance.Read();
        if (!result.Success)
            resultsLabel.Text = "Failed to get barcode";

        else
        {
            var msg = String.Format("Barcode: {0} - {1}", result.Format, result.Code);

            resultsLabel.Text = msg;

        }  

Viewing all articles
Browse latest Browse all 91519

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>