I used the SlidingMenu library in my application, according to https://github.com/xamarin/monodroid-samples/tree/master/SlidingMenu. I build and run application successfully on the android 4.0+, but I failed run application on the android 2.2, but I saw the android sliding menu https://github.com/jfeinstein10/SlidingMenu, it supports from android 2.1.
This is error code:
at Android.Runtime.JNIEnv.CallNonvirtualVoidMethod (intptr,intptr,intptr,Android.Runtime.JValue[]) <0x00088>
at Com.Slidingmenu.Lib.App.SlidingActivity.SetBehindContentView (int) <0x00237>
at regrecall.HomeActivity.OnCreate (Android.OS.Bundle) <0x00097>
at Com.Slidingmenu.Lib.App.SlidingActivity.n_OnCreate_Landroid_os_Bundle_ (intptr,intptr,intptr) <0x0005f>
at (wrapper dynamic-method) object.ffcb4990-4b21-40ac-9622-acbf3c40174b (intptr,intptr,intptr) <0x00043>
--- End of managed exception stack trace ---
android.view.InflateException: Binary XML file line #1: Error inflating class android.widget.ListView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.slidingmenu.lib.app.SlidingActivity.setBehindContentView(SlidingActivity.java:83)
at regrecall.HomeActivity.n_onCreate(Native Method)
at regrecall.HomeActivity.onCreate(HomeActivity.java:32)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.ListView.<init>(ListView.java:153)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_background.png from drawable resource ID #0x7f020081: .xml extension required
at android.content.res.Resources.loadColorStateList(Resources.java:1824)
at android.content.res.TypedArray.getColor(TypedArray.java:319)
at android.widget.AbsListView.<init>(AbsListView.java:554)
at android.widget.ListView.<init>(ListView.java:157)
... 26 more
Forget me that I can't copy whole log, since the logs on the another machine can't connect to network. I analyse this log, it crashed at SldingMenuActivity onCreate method, it failed to create the listview for the behind view on the activity, but it can work on the android 4.0+, it's too strange.
The problem I found: my listview can't infalte on android 2.2, even my layout is so simple below
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="#+id/Home_MenuList"
/>
</LinearLayout>
If you take a look at the Caused by section in your Stack Trace it tells you:
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/common_background.png from drawable resource ID #0x7f020081: .xml extension required
There is something wrong with that resource, are any of the ListViewItems using this Resource Drawable?
Related
I have an Android app which has a minimum SDK at 2.1 and I am getting the following stack trace in the developer console:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.versions.MyPhone}: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2705)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2721)
at android.app.ActivityThread.access$2300(ActivityThread.java:132)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4669)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:203)
at android.app.Activity.setContentView(Activity.java:1656)
at com.versions.MyPhone.onCreate(MyPhone.java:49)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.LinearLayout.<init>(LinearLayout.java:115)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 21 more
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1885)
at android.view.View.<init>(View.java:1834)
at android.view.ViewGroup.<init>(ViewGroup.java:285)
The error doesn't happen in the newer devices with an updated Os.
Please help me resolve the issue or point me in the right direction.
Based on the java.lang.OutOfMemoryError: bitmap size exceeds VM budget message in the stack trace, it appears that one of the images in the view being opened in your onCreate() is too large.
Here's a page with some guidance. The main idea is to load a scaled down version of the image. I've found it best to also scale down (resolution, color-depth, etc.) the actual image file to maximize loading speed.
I put an application on Play Store and I received a Crash report that I'm having an hard time to reproduce.
It comes from a V858 (hwu8160) device running Android 2.2. The exception it raised is the following:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mariosangiorgio.FutsalCoach/com.mariosangiorgio.FutsalCoach.FutsalCoachActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:201)
at android.app.Activity.setContentView(Activity.java:1647)
at com.mariosangiorgio.FutsalCoach.FutsalCoachActivity.onCreate(FutsalCoachActivity.java:89)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.TextView.<init>(TextView.java:352)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more
Caused by: java.lang.UnsupportedOperationException: Can't convert to dimension: type=0x1
at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:463)
at android.widget.TextView.<init>(TextView.java:677)
... 26 more
I setup an emulator running Android 2.2 but I cannot reproduce the issue. Do you have any suggestion about what I should to in order to find the cause of the error and fix it?
This is what I have in the activity layout file at line 10:
<TextView
android:id="#+id/match_timer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="20dp"
android:text="#string/default_time"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="#dimen/bigClockFontSize"
android:singleLine="true" />
It seems that for some reason the device is not loading the #dimen/bigClockFontSize value.
I managed to trigger the error in the emulator by removing the value from res/values/dimens.xml.
The device presenting the error is using the italian locale and the device has a small screen.
I have the following resources files:
values/dimens.xml
values/strings.xml
values/styles.xml
values-it/strings.xml
values-normal-hdpi/dimens.xml
values-normal-xxhdpi/dimens.xml
I assume that the device should resolve the values/dimes.xml file. Does it do that?
Try these links:
Android View inflateException
android.view.InflateException: Binary XML file line #30: Error inflating class <unknown>
android.view.InflateException: Binary XML file line #12: Error inflating class <unknown>
Hope you find your answer from here.
i got following strange exception on only andorid simulator 2.0
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.markupartist.android.example.pulltorefresh/com.markupartist.android.example.pulltorefresh.PullToRefreshActivity}: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #10: Error inflating class com.markupartist.android.widget.PullToRefreshListView
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
at android.app.Activity.setContentView(Activity.java:1647)
at com.markupartist.android.example.pulltorefresh.PullToRefreshActivity.onCreate(PullToRefresh Activity.java:21)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at com.markupartist.android.widget.PullToRefreshListView. (PullToRefreshListView.java:54)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 21 more
Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030002
at android.content.res.Resources.getValue(Resources.java:892)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:1869)
at android.content.res.Resources.getLayout(Resources.java:731)
at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.markupartist.android.widget.PullToRefreshListView.init(PullToRefreshListView.java:80)
... 25 more
when i tested on andorid 1.6 , 2.01,2.1,2.2,2.3 ,4.0 it works completely,
is this a simulator bug of 2.0
please give me some information about this
Thanks
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.falling.inairproandmark/com.falling.inairproandmark.Q9Popup}: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
at android.app.ActivityThread.access$2300(ActivityThread.java:125)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #9: Error inflating class <unknown>
at android.view.LayoutInflater.createView(LayoutInflater.java:513)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:219)
at android.app.Activity.setContentView(Activity.java:1647)
at com.falling.inairproandmark.Q9Popup.onCreate(Q9Popup.java:36)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
... 11 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.Button.<init>(Button.java:65)
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
at android.view.LayoutInflater.createView(LayoutInflater.java:500)
... 22 more
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
at android.graphics.Bitmap.nativeCreate(Native Method)
at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
at android.content.res.Resources.loadDrawable(Resources.java:1709)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1885)
at android.widget.TextView.<init>(TextView.java:352)
at android.widget.Button.<init>(Button.java:69)
... 26 more
==
here's my xml layout:
<?xml version="1.0" encoding="utf-8"?>
<AbsoluteLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:background="#drawable/q9popup" android:id="#+id/qnine"
android:layout_width="fill_parent" android:layout_height="fill_parent">
</Button>
<com.google.ads.AdView android:id="#+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="**********"
ads:adSize="BANNER"
ads:loadAdOnCreate="true"/>
</AbsoluteLayout>
I don't understand why I keep getting this error :S
Please help.
Thanks
Android cannot allocate the memory for the Button. Pre-Honeycomb allocates the memory for a bitmap natively, outside the Dalvik VM, using malloc and has to rely on Java finalizers to free that memory again. Unless you call Bitmap.recycle that is.
See http://www.youtube.com/watch?v=_CruQY55HOk&feature=player_detailpage#t=650s for some info on allocation of Bitmaps.
So you have to figure out why external allocation is so high in your app. Maybe AdMob is the cause. Make sure to invoke AdView.destroy in your activity's onDestroy.
I am trying to inflate a layout containing a Fragment using the backwards compatibility package. I took the jar file and placed it in the libs folder of my project. I extended Fragment and then tried to inflate it by setting the contentView of the Activity to
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<fragment
class="com.test.fragments.AdFragment"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/></LinearLayout>
But when I set the content view it fails with a ClassNotFoundException for the fragment tag.
Here is the logcat output.
java.lang.RuntimeException: Unable to start activity ComponentInfo{}: \
android.view.InflateException: Binary XML file line #51: \
Error inflating class fragment
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1777)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1793)
at android.app.ActivityThread.access$1500(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:939)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:3848)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #51: \
Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:581)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:211)
at android.app.Activity.setContentView(Activity.java:1657)
at com.test.base.activities.TabbedStoreActivity.onCreate(TabbedStoreActivity.java:46)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1731)
... 11 more
Caused by: java.lang.ClassNotFoundException: android.view.fragment in loader \
dalvik.system.PathClassLoader[/system/framework/com.google.android.maps.jar: \
/data/app/com.test.test.apk]
at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)
at java.lang.ClassLoader.loadClass(ClassLoader.java:551)
at java.lang.ClassLoader.loadClass(ClassLoader.java:511)
at android.view.LayoutInflater.createView(LayoutInflater.java:471)
at android.view.LayoutInflater.onCreateView(LayoutInflater.java:549)
at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:66)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
... 20 more
Make sure your activity is inheriting from FragmentActivity, otherwise <fragment> does not work. Here is a sample project demonstrating this.