I'm going through the documentation at Hello, MapView to add a MapView to my Activity.
When I launch my Activity, I get an inflation error on the MapView.
Here is the MapView in my layout xml:
<com.google.android.maps.MapView
android:id="#+id/mymap"
android:layout_width="fill_parent"
android:layout_height="200dip"
android:clickable="true"
android:apiKey="withheld"
/>
Here is the code in my MapActivity (the class is named ActivityDetails and extends MapActivity) class:
MapView mMap;
mMap = (MapView) findViewById(R.id.mymap);
mMap.setBuiltInZoomControls(true);
Here is the error:
06-10 09:15:24.277: ERROR/AndroidRuntime(228): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.my.app/com.my.app.activity.ActivityDetails}: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.os.Looper.loop(Looper.java:123)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.main(ActivityThread.java:4363)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Method.invoke(Method.java:521)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at dalvik.system.NativeStart.main(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: android.view.InflateException: Binary XML file line #35: Error inflating class com.google.android.maps.MapView
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:565)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.rInflate(LayoutInflater.java:621)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Activity.setContentView(Activity.java:1622)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.my.app.activity.ActivityDetails.onCreate(ActivityDetails.java:128)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 11 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.reflect.InvocationTargetException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:237)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.constructNative(Native Method)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 23 more
06-10 09:15:24.277: ERROR/AndroidRuntime(228): Caused by: java.lang.NullPointerException
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapActivity.setupMapView(MapActivity.java:183)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:279)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): at com.google.android.maps.MapView.<init>(MapView.java:254)
06-10 09:15:24.277: ERROR/AndroidRuntime(228): ... 27 more
As far as I can tell, I've done everything correct as described in the documentation. I've set my build target to Google APIs, I've added the uses-library tag to my Manifest, I'm running in an emulator with the Google API target...
The problem was I was calling super.onCreate() after setContentView() in the MapActivity.
You are using the wrong xml for your MapView
The class extending the MapActivity should call setContentView() with the xml containing stuff like this
<?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">
<com.google.android.maps.MapView
android:id="#+id/racemap"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_x="0px"
android:enabled="true"
android:clickable="true"
android:apiKey="blahblahblah" />
</LinearLayout>
So instead of using layout_details.xml use layout.xml
Insert this on your xml declaration of the MapView
xmlns:android="http://schemas.android.com/apk/res/android"
Related
there is no error in application but when running it in android emulator I get a sorry message saying my application "has stopped unexpectedly. Please try again".I'm new in android and don't know what is wrong. Please help me.
Logcat is as follows:
06-10 16:55:38.587: D/szipinf(460): Initializing inflate state
06-10 16:55:45.569: D/szipinf(460): Initializing inflate state
06-10 16:55:48.497: D/szipinf(460): Initializing inflate state
06-10 16:55:51.207: I/dalvikvm(460): Jit: resizing JitTable from 512 to 1024
06-10 16:55:53.140: D/szipinf(460): Initializing inflate state
06-10 16:56:02.108: D/AndroidRuntime(460): Shutting down VM
06-10 16:56:02.108: W/dalvikvm(460): threadid=1: thread exiting with uncaught exception (group=0x40015560)
06-10 16:56:02.188: E/AndroidRuntime(460): FATAL EXCEPTION: main
06-10 16:56:02.188: E/AndroidRuntime(460): java.lang.RuntimeException: Unable to start activity ComponentInfo{de.uvwxy.footpath/de.uvwxy.footpath.gui.Loader}: java.lang.StringIndexOutOfBoundsException
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1647)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.os.Looper.loop(Looper.java:123)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.main(ActivityThread.java:3683)
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.reflect.Method.invoke(Method.java:507)
06-10 16:56:02.188: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-10 16:56:02.188: E/AndroidRuntime(460): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-10 16:56:02.188: E/AndroidRuntime(460): at dalvik.system.NativeStart.main(Native Method)
06-10 16:56:02.188: E/AndroidRuntime(460): Caused by: java.lang.StringIndexOutOfBoundsException
06-10 16:56:02.188: E/AndroidRuntime(460): at java.lang.String.substring(String.java:1651)
06-10 16:56:02.188: E/AndroidRuntime(460): at de.uvwxy.footpath.gui.Loader.onCreate(Loader.java:231)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-10 16:56:02.188: E/AndroidRuntime(460): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-10 16:56:02.188: E/AndroidRuntime(460): ... 11 more
06-10 16:56:12.558: I/Process(460): Sending signal. PID: 460 SIG: 9
As you can tell by reading the stack trace, you have a StringIndexOutOfBoundsException, stemming from line 231 of your de.uvwxy.footpath.gui.Loader class, in its onCreate() method.
You're getting a StringIndexOutOfBoundsException in the Loader.java class at line 231. Check the substringing you're doing at that line.
Trying with the facebook sdk and want to try running the sample app profilepicture .Follow all the step of configuration given in the facebook.developer official site .While import of the facebook sdk some error and exclaimation mark came but that thing are solved .But while running the simple app profilepicture some exception are showing on the logcat.here the details of the logcat with classnotfound exception:
06-10 18:06:48.039: I/Process(621): Sending signal. PID: 621 SIG: 9
06-10 18:08:22.509: W/dalvikvm(697): Unable to resolve superclass of Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity; (59)
06-10 18:08:22.621: W/dalvikvm(697): Link of class 'Lcom/facebook/samples/profilepicture/ProfilePictureSampleActivity;' failed
06-10 18:08:22.621: D/AndroidRuntime(697): Shutting down VM
06-10 18:08:22.640: W/dalvikvm(697): threadid=1: thread exiting with uncaught exception (group=0x409961f8)
06-10 18:08:22.689: E/AndroidRuntime(697): FATAL EXCEPTION: main
06-10 18:08:22.689: E/AndroidRuntime(697): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.facebook.samples.profilepicture/com.facebook.samples.profilepicture.ProfilePictureSampleActivity}: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1879)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1980)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.access$600(ActivityThread.java:122)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1146)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.os.Looper.loop(Looper.java:137)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.main(ActivityThread.java:4340)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 18:08:22.689: E/AndroidRuntime(697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.NativeStart.main(Native Method)
06-10 18:08:22.689: E/AndroidRuntime(697): Caused by: java.lang.ClassNotFoundException: com.facebook.samples.profilepicture.ProfilePictureSampleActivity
06-10 18:08:22.689: E/AndroidRuntime(697): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-10 18:08:22.689: E/AndroidRuntime(697): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.Instrumentation.newActivity(Instrumentation.java:1023)
06-10 18:08:22.689: E/AndroidRuntime(697): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1870)
06-10 18:08:22.689: E/AndroidRuntime(697): ... 11 more
so can anyone tell me what will be the solution for this exception.and this exception is coming for every sample app which came with the facebook sdk.Thanks for any hint.
Following the My First Triangle tutorial from this link: My First Triangle
the desktop version works perfectly fine, however when i deploy the android emulator version i get this error:
Unfortunately, MyFirstTriangleAndroid has stopped.
Any suggestions to help fix this problem? I'm using libgdx-0.9.4.
here is the catlog:
06-10 15:32:00.623: D/dalvikvm(528): Not late-enabling CheckJNI (already on)
06-10 15:32:01.653: E/dalvikvm(528): Could not find class 'com.test.myfirsttriangle.MyFirstTriangle', referenced from method com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate
06-10 15:32:01.653: W/dalvikvm(528): VFY: unable to resolve new-instance 684 (Lcom/test/myfirsttriangle/MyFirstTriangle;) in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;
06-10 15:32:01.653: D/dalvikvm(528): VFY: replacing opcode 0x22 at 0x0003
06-10 15:32:01.653: D/dalvikvm(528): DexOpt: unable to opt direct call 0x1c88 at 0x05 in Lcom/test/myfirsttriangle/MyFirstTriangleAndroidActivity;.onCreate
06-10 15:32:01.713: D/dalvikvm(528): Trying to load lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): Added shared lib /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8
06-10 15:32:01.713: D/dalvikvm(528): No JNI_OnLoad found in /data/data/com.test.myfirsttriangle/lib/libgdx.so 0x412a58e8, skipping init
06-10 15:32:01.783: D/AndroidRuntime(528): Shutting down VM
06-10 15:32:01.783: W/dalvikvm(528): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
06-10 15:32:01.793: E/AndroidRuntime(528): FATAL EXCEPTION: main
06-10 15:32:01.793: E/AndroidRuntime(528): java.lang.NoClassDefFoundError: com.test.myfirsttriangle.MyFirstTriangle
06-10 15:32:01.793: E/AndroidRuntime(528): at com.test.myfirsttriangle.MyFirstTriangleAndroidActivity.onCreate(MyFirstTriangleAndroidActivity.java:11)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Activity.performCreate(Activity.java:4465)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.access$600(ActivityThread.java:123)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Handler.dispatchMessage(Handler.java:99)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.os.Looper.loop(Looper.java:137)
06-10 15:32:01.793: E/AndroidRuntime(528): at android.app.ActivityThread.main(ActivityThread.java:4424)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invokeNative(Native Method)
06-10 15:32:01.793: E/AndroidRuntime(528): at java.lang.reflect.Method.invoke(Method.java:511)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
06-10 15:32:01.793: E/AndroidRuntime(528): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
06-10 15:32:01.793: E/AndroidRuntime(528): at dalvik.system.NativeStart.main(Native Method)
06-10 15:32:06.703: I/Process(528): Sending signal. PID: 528 SIG: 9
This tutorial is kind of outdated. Google decided to change the way dependencies are referenced, you need to go to your Android project's properties -> Java Build Path -> Order & Export tab, and make sure everything is exported (check the boxes).
I'd highly recommend reading this new article detailing the steps required to setup a libgdx project in Eclipse: http://code.google.com/p/libgdx/wiki/ProjectSetupNew?ts=1339344711&updated=ProjectSetupNew
Additionally i'd recommend going through the new developer guide wiki articles, here is the table of contents: http://code.google.com/p/libgdx/wiki/TableOfContents?tm=6
i have a error on my android project that i cant solve.
I have a game menu layout in one xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/RootView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#drawable/gamemenu_background"
android:orientation="vertical" >
<Button
android:id="#+id/gaveup_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/gaveup_button">
</Button>
<Button
android:id="#+id/choice_a_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/choice_a_button">
</Button>
<Button
android:id="#+id/choice_b_button"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:background="#drawable/choice_b_button"/>
</RelativeLayout>
So for each button i have an xml and an image in folder drawable:
choice_a_button_xml.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#drawable/choice_a_button"></item>
</selector>
choice_b_button_xml.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#drawable/choice_b_button"></item>
</selector>
In layout manager of eclipse de layout are good but when i run the app on a virtual device i have an error and app not start:
05-15 01:22:52.284: D/dalvikvm(341): GC freed 605 objects / 48664 bytes in 166ms
05-15 01:22:52.446: D/dalvikvm(341): GC freed 59 objects / 2304 bytes in 46ms
05-15 01:22:52.814: D/dalvikvm(341): GC freed 138 objects / 6344 bytes in 42ms
05-15 01:22:53.124: D/dalvikvm(341): GC freed 48 objects / 1864 bytes in 44ms
05-15 01:22:53.724: E/dalvikvm-heap(341): 3686400-byte external allocation too large for this process.
05-15 01:22:53.724: E/(341): VM won't let us allocate 3686400 bytes
05-15 01:22:53.724: D/skia(341): --- decoder->decode returned false
05-15 01:22:53.735: D/AndroidRuntime(341): Shutting down VM
05-15 01:22:53.735: W/dalvikvm(341): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
05-15 01:22:53.735: E/AndroidRuntime(341): Uncaught handler: thread main exiting due to uncaught exception
05-15 01:22:53.754: E/AndroidRuntime(341): java.lang.RuntimeException: Unable to start activity ComponentInfo{sal.app/sal.app.SALActivity}: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.os.Handler.dispatchMessage(Handler.java:99)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.os.Looper.loop(Looper.java:123)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread.main(ActivityThread.java:4363)
05-15 01:22:53.754: E/AndroidRuntime(341): at java.lang.reflect.Method.invokeNative(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341): at java.lang.reflect.Method.invoke(Method.java:521)
05-15 01:22:53.754: E/AndroidRuntime(341): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
05-15 01:22:53.754: E/AndroidRuntime(341): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
05-15 01:22:53.754: E/AndroidRuntime(341): at dalvik.system.NativeStart.main(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: android.view.InflateException: Binary XML file line #29: Error inflating class <unknown>
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:513)
05-15 01:22:53.754: E/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.rInflate(LayoutInflater.java:618)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:407)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-15 01:22:53.754: E/AndroidRuntime(341): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:198)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.Activity.setContentView(Activity.java:1622)
05-15 01:22:53.754: E/AndroidRuntime(341): at sal.app.SALActivity.onCreate(SALActivity.java:23)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
05-15 01:22:53.754: E/AndroidRuntime(341): ... 11 more
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: java.lang.reflect.InvocationTargetException
05-15 01:22:53.754: E/AndroidRuntime(341): at android.widget.Button.<init>(Button.java:65)
05-15 01:22:53.754: E/AndroidRuntime(341): at java.lang.reflect.Constructor.constructNative(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341): at java.lang.reflect.Constructor.newInstance(Constructor.java:446)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.LayoutInflater.createView(LayoutInflater.java:500)
05-15 01:22:53.754: E/AndroidRuntime(341): ... 22 more
05-15 01:22:53.754: E/AndroidRuntime(341): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
05-15 01:22:53.754: E/AndroidRuntime(341): at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:447)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:323)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:697)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.content.res.Resources.loadDrawable(Resources.java:1705)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.content.res.TypedArray.getDrawable(TypedArray.java:548)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.view.View.<init>(View.java:1850)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.widget.TextView.<init>(TextView.java:326)
05-15 01:22:53.754: E/AndroidRuntime(341): at android.widget.Button.<init>(Button.java:69)
05-15 01:22:53.754: E/AndroidRuntime(341): ... 26 more
05-15 01:22:53.774: I/dalvikvm(341): threadid=7: reacting to signal 3
05-15 01:22:53.774: E/dalvikvm(341): Unable to open stack trace file '/data/anr/traces.txt': Permission denied
Whats happen there? This error only ocurre in virtual devices with large screens.
This app work if i set Max VM application heap size of my virtual device to 48. But this is too much..There is any way to put program consumes less memory?
please help me
What #Michaeldcooney said and you should also check for memory leaks. Also, what's the VM memory size (that's the size of memory usable by an application, not the device total memory size) for your virtual devices?
I think the crash is due to the line that says:
Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
You probably need to scale down your images.
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