I am completely lost with this one. My app works perfectly on API 2.1 on my handset and through the emulator.
I have just run it through a 2.2 emulator and I am getting a crash and this error:
04-27 20:29:41.293: ERROR/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.ebp/com.ebp.ebpMainMenu}: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.os.Handler.dispatchMessage(Handler.java:99)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.os.Looper.loop(Looper.java:123)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.main(ActivityThread.java:4363)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Method.invoke(Method.java:521)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at dalvik.system.NativeStart.main(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: android.view.InflateException: Binary XML file line #2: Error inflating class android.widget.LinearLayout
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:385)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.Activity.setContentView(Activity.java:1622)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at com.ebp.ebpMainMenu.onCreate(ebpMainMenu.java:58)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): ... 11 more
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: java.lang.reflect.InvocationTargetException
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.widget.LinearLayout.<init>(LinearLayout.java:92)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Constructor.constructNative(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): ... 21 more
04-27 20:29:41.293: ERROR/AndroidRuntime(341): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.nativeCreate(Native Method)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createBitmap(Bitmap.java:468)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createBitmap(Bitmap.java:435)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:340)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:488)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:462)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.content.res.Resources.loadDrawable(Resources.java:1705)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.View.<init>(View.java:1850)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.View.<init>(View.java:1799)
04-27 20:29:41.293: ERROR/AndroidRuntime(341): at android.view.ViewGroup.<init>(ViewGroup.java:284)
In the main.xml file, here is line #2
<LinearLayout
android:id="#+id/linearLayout3"
android:background="#drawable/mainbackground"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical">
and here is main line 58:
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget may be the real culprit here. Try using smaller image to see if it is a memory-related issue.
Check out these links for examples of similar issues: java.lang.OutOfMemoryError: bitmap size exceeds VM budget - android - how many images?
OutOfMemory exception when loading bitmap from external storage
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 am trying to change my App which has a bunch of single Activities into a swipe tab app.
i want 3 activities in the swipe tabs. I used the google example wich eclipse created for me. I don't seem to get the correct way of doing that.
I have the following (relevant) code (the other stuff is in eclipse, it's too much to post here):
Main.class which is called at launch (the last inner class of it):
public static class DummySectionFragment extends Fragment {
public static final String ARG_SECTION_NUMBER = "section_number";
// public DummySectionFragment() {
// }
#Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.activity_fragment,
container, false);
return rootView;
}
}
activity_fragment.xml:
<fragment
android:id="#+id/main"
android:name="com.mikebdev.refuel.MainActivity"
class="com.mikebdev.refuel.MainActivity"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1" />
<fragment
android:id="#+id/stats"
android:name="com.mikebdev.refuel.Statistics"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="2" />
<fragment
android:id="#+id/refuel"
android:name="com.mikebdev.refuel.ReFuel"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="3" />
The Activities all extend FragmentActivity from android.support.v4.app.FragmentActivity
now when starting my app, i get the following error:
04-27 12:08:11.244: E/AndroidRuntime(28728): FATAL EXCEPTION: main
04-27 12:08:11.244: E/AndroidRuntime(28728): android.view.InflateException: Binary XML file line #8: Error inflating class fragment
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.rInflate(LayoutInflater.java:746)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.inflate(LayoutInflater.java:489)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.inflate(LayoutInflater.java:396)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.mikebdev.refuel.Main$DummySectionFragment.onCreateView(Main.java:184)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.performCreateView(Fragment.java:1460)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:911)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1088)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:682)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1444)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:461)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentStatePagerAdapter.finishUpdate(FragmentStatePagerAdapter.java:163)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.populate(ViewPager.java:1011)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.populate(ViewPager.java:880)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.view.ViewPager.onMeasure(ViewPager.java:1374)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.LinearLayout.measureVertical(LinearLayout.java:847)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.LinearLayout.onMeasure(LinearLayout.java:588)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewGroup.measureChildWithMargins(ViewGroup.java:4825)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.widget.FrameLayout.onMeasure(FrameLayout.java:310)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.policy.impl.PhoneWindow$DecorView.onMeasure(PhoneWindow.java:2176)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.View.measure(View.java:15518)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.performMeasure(ViewRootImpl.java:1874)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.measureHierarchy(ViewRootImpl.java:1089)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1265)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer.doCallbacks(Choreographer.java:562)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer.doFrame(Choreographer.java:532)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Handler.handleCallback(Handler.java:725)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Handler.dispatchMessage(Handler.java:92)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.os.Looper.loop(Looper.java:137)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.app.ActivityThread.main(ActivityThread.java:5041)
04-27 12:08:11.244: E/AndroidRuntime(28728): at java.lang.reflect.Method.invokeNative(Native Method)
04-27 12:08:11.244: E/AndroidRuntime(28728): at java.lang.reflect.Method.invoke(Method.java:511)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
04-27 12:08:11.244: E/AndroidRuntime(28728): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
04-27 12:08:11.244: E/AndroidRuntime(28728): at dalvik.system.NativeStart.main(Native Method)
04-27 12:08:11.244: E/AndroidRuntime(28728): Caused by: java.lang.ClassCastException: com.mikebdev.refuel.MainActivity cannot be cast to android.support.v4.app.Fragment
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.instantiate(Fragment.java:394)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.Fragment.instantiate(Fragment.java:369)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:272)
04-27 12:08:11.244: E/AndroidRuntime(28728): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:676)
You can't have nested fragments embedded in a xml layout file. You'll have to add them at runtime.
Edit: There are countless tutorials on implementing swipeable tabs with fragments please look at them, many are self explanatory. The main points are:
create a layout file which will contain the tabs and the ViewPager
create the fragments that will be used as the tabs/pages in the ViewPager
create a FragmentPagerAdapter and assign it to the ViewPager
bind the tabs selection to the ViewPager pages.
You could use the ViewPager directly in the Activity or you could use a wrapper Fragment, the difference is that you'll need to pass getChildFragmentManager() to the FragmentPagerAdapter instead of getSupportFragmentManager().
After a while i was able to solve everything by adding a switch case statement here:
#Override
public Fragment getItem(int position) {
// getItem is called to instantiate the fragment for the given page.
// Return a DummySectionFragment (defined as a static inner class
// below) with the page number as its lone argument.
Fragment fragment;
switch (position) {
case 0:
fragment = new StatisticsFragment();
break;
case 1:
fragment = new MainActivityFragment();
break;
case 2:
fragment = new DbListViewFragment();
break;
default:
fragment = new DummySectionFragment();
break;
}
return fragment;
}
and I made a copy of my activities and converted those to fragments like explained on this video:
Converting An Activity To A Fragment
now everything seems to work.
My reports provide me this error but I can't understand how is it possible?
java.lang.RuntimeException: Unable to start activity ComponentInfo{net.aviascanner.aviascanner/net.aviascanner.aviascanner.ui.activities.GetCitiesActivity}: android.view.InflateException: Binary XML file line #11: Error inflating class <unknown>
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2753)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
at android.app.ActivityThread.access$2600(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.view.InflateException: Binary XML file line #11: 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.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
... 12 more
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.EditText.<init>(EditText.java:51)
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)
... 25 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
at android.content.res.Resources.loadDrawable(Resources.java:1725)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1901)
at android.widget.TextView.<init>(TextView.java:440)
at android.widget.EditText.<init>(EditText.java:55)
... 29 more
Caused by: java.lang.NullPointerException
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
at android.content.res.Resources.loadDrawable(Resources.java:1722)
... 33 more
android.view.InflateException: Binary XML file line #11: 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.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
at android.app.ActivityThread.access$2600(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at android.widget.EditText.<init>(EditText.java:51)
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)
... 25 more
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
at android.content.res.Resources.loadDrawable(Resources.java:1725)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1901)
at android.widget.TextView.<init>(TextView.java:440)
at android.widget.EditText.<init>(EditText.java:55)
... 29 more
Caused by: java.lang.NullPointerException
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
at android.content.res.Resources.loadDrawable(Resources.java:1722)
... 33 more
java.lang.reflect.InvocationTargetException
at android.widget.EditText.<init>(EditText.java:51)
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)
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.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
at android.app.ActivityThread.access$2600(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
at android.content.res.Resources.loadDrawable(Resources.java:1725)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1901)
at android.widget.TextView.<init>(TextView.java:440)
at android.widget.EditText.<init>(EditText.java:55)
... 29 more
Caused by: java.lang.NullPointerException
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
at android.content.res.Resources.loadDrawable(Resources.java:1722)
... 33 more
android.content.res.Resources$NotFoundException: File res/drawable/selector_edittext.xml from drawable resource ID #0x7f0200c4
at android.content.res.Resources.loadDrawable(Resources.java:1725)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1901)
at android.widget.TextView.<init>(TextView.java:440)
at android.widget.EditText.<init>(EditText.java:55)
at android.widget.EditText.<init>(EditText.java:51)
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)
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.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
at android.app.ActivityThread.access$2600(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
at android.content.res.Resources.loadDrawable(Resources.java:1722)
... 33 more
java.lang.NullPointerException
at android.graphics.drawable.DrawableContainer$DrawableContainerState.addChild(DrawableContainer.java:349)
at android.graphics.drawable.StateListDrawable$StateListState.addStateSet(StateListDrawable.java:265)
at android.graphics.drawable.StateListDrawable.inflate(StateListDrawable.java:173)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:796)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:737)
at android.content.res.Resources.loadDrawable(Resources.java:1722)
at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
at android.view.View.<init>(View.java:1901)
at android.widget.TextView.<init>(TextView.java:440)
at android.widget.EditText.<init>(EditText.java:55)
at android.widget.EditText.<init>(EditText.java:51)
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)
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.rInflate(LayoutInflater.java:621)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
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.actionbarsherlock.internal.ActionBarSherlockCompat.setContentView(ActionBarSherlockCompat.java:853)
at com.actionbarsherlock.app.SherlockFragmentActivity.setContentView(SherlockFragmentActivity.java:262)
at net.aviascanner.aviascanner.ui.activities.GetCitiesActivity.onCreate(GetCitiesActivity.java:115)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2717)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2769)
at android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:3905)
at android.app.ActivityThread.access$2600(ActivityThread.java:129)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2121)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:143)
at android.app.ActivityThread.main(ActivityThread.java:4717)
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:860)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
at dalvik.system.NativeStart.main(Native Method)
I have found this error in my application also. In my application I solved my problem by making the copies of the drawables in all the folders of the drawables i.e. drawable-ldpi, drawable-mdpi, drawable-hdpi, drawable-xhdpi. This works correctly in my application. Hope this will solve your problem if u have not kept the drawables into all the provided drawable folders.
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.