image is not a power of 2? - android

So, i've made the raindrop tutorial project by libGDX. However, when i attempt to deploy it to the emulator i get an error saying that the image is not a power of 2. But i did re-size the images to be 48X48 using GIMP (as the tutorial had suggested). I believe he had added in some code to ensure that it would be possible to add in images that were not necessarily a power of two?
Does anyone know how i would fix this? Making it a power of two is a bit limiting.. isn't it? I followed the tutorial very closely! So... i'm not sure where to go from here. Noob at libGDX.
LogCat Dump:
06-11 00:22:50.942: W/dalvikvm(545): threadid=11: thread exiting with uncaught exception (group=0x409c01f8)
06-11 00:22:50.952: E/AndroidRuntime(545): FATAL EXCEPTION: GLThread 72
06-11 00:22:50.952: E/AndroidRuntime(545): com.badlogic.gdx.utils.GdxRuntimeException: Texture width and height must be powers of two: 48x48
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.graphics.Texture.uploadImageData(Texture.java:197)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.graphics.Texture.load(Texture.java:179)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.graphics.Texture.create(Texture.java:159)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:133)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.graphics.Texture.<init>(Texture.java:122)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.drop.Drop.create(Drop.java:38)
06-11 00:22:50.952: E/AndroidRuntime(545): at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:292)
06-11 00:22:50.952: E/AndroidRuntime(545): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1455)
06-11 00:22:50.952: E/AndroidRuntime(545): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
06-11 00:22:51.041: I/AndroidInput(545): sensor listener tear down
06-11 00:22:51.041: I/AndroidGraphics(545): Managed meshes/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed textures/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed shaders/app: { }
06-11 00:22:51.041: I/AndroidGraphics(545): Managed buffers/app: { }

48x48 is not a power of two. The app requires OpenGL ES 2.0 as stated in the text. The standard emulator only runs OpenGL ES 1.0. You can rescale the image to 32x32, then everything will work as expected on OpenGL ES 1.x as well.
I'd recommend not using the emulator for testing OpenGL ES apps. Use a real device instead.

You can stop it from enforcing the power of two requirement by setting the following line of code in your game class in the create() method:
Texture.setEnforcePotImages(false);

this worked for me
change all "GL10" imported from "com.badlogic.gdx.graphics.GL10" to "GL20" imported from "com.badlogic.gdx.graphics.GL20"

Related

Xamarin Android Facebook Login

I'm using Xamarin Android with Visual Studio, and I am trying to use the facebook sdk to do native login. I have managed to use Xamarin.Auth however, this presents a webview which I do not want to use if the user has the facebook app.
I am using Xamarin Android Player
So far I have completed the following:
Intalled the facebook Android SDK
Created a facebook app
Installed the facebook apk on the android player
I have also updated the androidmanifest.xml as below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="FacebookExperiment.FacebookExperiment" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="21" />
<application android:label="FacebookExperiment" android:icon="#drawable/Icon"></application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="#string/facebook_app_id" />
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="#android:style/Theme.Translucent.NoTitleBar"
android:label="#string/app_name" />
</manifest>
I've also included my appID in the strings.xml. At this point everything builds fine and I can deploy the application to the Xamarin Android Player.
The next step I took was to use the facebook login button, so I updated the my Main.xml to 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">
<Button
android:id="#+id/MyButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="#string/Hello" />
<com.facebook.login.widget.LoginButton
android:id="#+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />
</LinearLayout>
I got the details from https://developers.facebook.com/docs/facebook-login/android/v2.3.
public class MainActivity : Activity
{
int count = 1;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
FacebookSdk.SdkInitialize(ApplicationContext);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
}
Now when I build I don't receive any errors, when I deploy to Xamarin Android Player I receive an Unhandled Exception in Visual Studio- The call stack doesn't provide with much information (I can't seem to copy it ).
The output:
06-11 05:54:28.522 D/ ( 3987): HostConnection::get() New Host Connection established 0x9fec50c0, tid 4013
06-11 05:54:28.534 D/libEGL ( 3987): loaded /system/lib/egl/libGLESv1_CM_xap.so
06-11 05:54:28.539 D/libEGL ( 3987): loaded /system/lib/egl/libGLESv2_xap.so
06-11 05:54:28.554 I/OpenGLRenderer( 3987): Initialized EGL, version 1.4
06-11 05:54:28.576 E/OpenGLRenderer( 3987): Getting MAX_TEXTURE_SIZE from GradienCache
06-11 05:54:28.576 E/OpenGLRenderer( 3987): MAX_TEXTURE_SIZE: 16384
06-11 05:54:28.579 E/OpenGLRenderer( 3987): Getting MAX_TEXTURE_SIZE from Caches::initConstraints()
06-11 05:54:28.580 E/OpenGLRenderer( 3987): MAX_TEXTURE_SIZE: 16384
06-11 05:54:28.580 D/OpenGLRenderer( 3987): Enabling debug mode 0
06-11 05:54:28.606 W/EGL_xap ( 3987): eglSurfaceAttrib not implemented
06-11 05:54:28.606 W/OpenGLRenderer( 3987): Failed to set EGL_SWAP_BEHAVIOR on surface 0x9fe0ac80, error=EGL_SUCCESS
Thread started: #2
06-11 05:54:28.661 D/Mono ( 3987): DllImport attempting to load: '/system/lib/libc.so'.
06-11 05:54:28.661 D/Mono ( 3987): DllImport loaded library '/system/lib/libc.so'.
06-11 05:54:28.661 D/Mono ( 3987): DllImport searching in: '/system/lib/libc.so' ('/system/lib/libc.so').
06-11 05:54:28.661 D/Mono ( 3987): Searching for 'gettid'.
06-11 05:54:28.661 D/Mono ( 3987): Probing 'gettid'.
06-11 05:54:28.661 D/Mono ( 3987): Found as 'gettid'.
An unhandled exception occured.
06-11 05:54:32.333 E/AndroidRuntime( 3987): FATAL EXCEPTION: AsyncTask #2
06-11 05:54:32.333 E/AndroidRuntime( 3987): Process: FacebookExperiment.FacebookExperiment, PID: 3987
06-11 05:54:32.333 E/AndroidRuntime( 3987): java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.Object.hashCode()' on a null object reference
06-11 05:54:32.333 E/AndroidRuntime( 3987): at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:746)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at java.util.concurrent.ConcurrentHashMap.containsKey(ConcurrentHashMap.java:774)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at com.facebook.internal.Utility.queryAppSettings(Utility.java:825)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at com.facebook.login.widget.LoginButton$1.run(LoginButton.java:486)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
06-11 05:54:32.333 E/AndroidRuntime( 3987): at java.lang.Thread.run(Thread.java:818)
06-11 05:54:36.066 I/Process ( 3987): Sending signal. PID: 3987 SIG: 9
I'm not sure why this is crashing at this point, have I missed something for button to fail ?
First of all ensure that you target above API 15, you have the correct facebook api key and you have installed all the required packages the facebook component requires.
Your OnCreate method should look something like this:
protected override async void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
FacebookSdk.SdkInitialize(ApplicationContext);
AppEventsLogger.ActivateApp(Application);
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
You will have to create your hash key(debug and release). Here is everything you need. You will just have to translate it from Java to C# which is quite easy. Hope I helped you.

OpenGl renderer on Android

I am trying to make a simple renderer with OpenGL2.0, made up only of a main activity, surface view, and renderer file. Whenever I run it on an avd, the screen turns black and says the program has encountered a problem. Here is the logcat
08-04 03:55:59.722: D/libEGL(6287): Emulator without GPU support detected. Fallback to software renderer.
08-04 03:55:59.821: I/Choreographer(6287): Skipped 292 frames! The application may be doing too much work on its main thread.
08-04 03:56:00.042: D/libEGL(6287): loaded /system/lib/egl/libGLES_android.so
08-04 03:56:00.801: D/gralloc_goldfish(6287): Emulator without GPU emulation detected.
08-04 03:56:00.835: W/dalvikvm(6287): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
08-04 03:56:00.881: E/AndroidRuntime(6287): FATAL EXCEPTION: GLThread 102
08-04 03:56:00.881: E/AndroidRuntime(6287): java.lang.IllegalArgumentException: No configs match configSpec
08-04 03:56:00.881: E/AndroidRuntime(6287): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:863)
08-04 03:56:00.881: E/AndroidRuntime(6287): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
08-04 03:56:00.881: E/AndroidRuntime(6287): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
08-04 03:56:00.881: E/AndroidRuntime(6287): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
08-04 03:56:02.155: I/Choreographer(6287): Skipped 121 frames! The application may be doing too much work on its main thread.
08-04 03:56:07.941: I/Process(6287): Sending signal. PID: 6287 SIG: 9
Can the problem be recognized from this or should I provide code as well?

Android AVD emulator not running app, but device does? (OpenGL)

Hi I am trying to run some sample openGl code on an emulator. I am new to Android development. It crashes on the emulator but not my device, a Samsung Galaxy Note phone N7000.
The AVD settings I tried were:
Target: Android 4.1 - API Level 16
CPU/ABI: ARM (armeabi-v7a)
SD Card: 32 MiB
Skin: Built-in : WGA800
Here are the errors on the console:
10-15 13:23:34.287: E/Trace(621): error opening trace file: No such file or directory (2)
10-15 13:23:34.848: D/libEGL(621): Emulator without GPU support detected. Fallback to software renderer.
10-15 13:23:34.878: D/libEGL(621): loaded /system/lib/egl/libGLES_android.so
10-15 13:23:34.947: D/gralloc_goldfish(621): Emulator without GPU emulation detected.
10-15 13:23:34.977: W/dalvikvm(621): threadid=11: thread exiting with uncaught exception (group=0x40a13300)
10-15 13:23:34.977: E/AndroidRuntime(621): FATAL EXCEPTION: GLThread 72
10-15 13:23:34.977: E/AndroidRuntime(621): java.lang.IllegalArgumentException: No configs match configSpec
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:863)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
10-15 13:23:34.977: E/AndroidRuntime(621): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
10-15 13:23:35.377: I/Choreographer(621): Skipped 67 frames! The application may be doing too much work on its main thread.
10-15 13:23:36.658: I/Choreographer(621): Skipped 72 frames! The application may be doing too much work on its main thread.
Thanks
Bob
10-15 13:23:34.848: D/libEGL(621): Emulator without GPU support detected. Fallback to software renderer.
Just recreate or edit your emulator and be sure that under the hardware list you have
GPU Emulation set to Yes

Android Hello World app crashes: IllegalArgumentException from Surface.lockCanvasNative

I am trying to run the simplest Hello World example app and looks like I can crash it even all it does is showing a TextView.
Steps to reproduce: Launch it in the emulator (1.5). Open the app - it shows the text view, then lock the phone by pressing "end call" button. Unlock by pressing "menu", then press "back". App crashes with "The process android.process.acore has stopped unexpectedly..." and Force Close button. It does not happen all the time, but I am able to reproduce it every time after wiping the user data at least.
I wonder if default Hello World is missing a detail which was considered too advanced for a hello world... Such problems with a basic example does not look very encouraging =)
Any idea what detail is missing and how to avoid this crash?
Stack (I've truncated timestamps):
37.478: DEBUG/KeyguardViewMediator(576): wakeWhenReadyLocked(82)
37.481: DEBUG/KeyguardViewMediator(576): handleWakeWhenReady(82)
37.481: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.110: DEBUG/KeyguardViewMediator(576): pokeWakelock(5000)
39.140: WARN/InputManagerService(576): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy#436e3fc0
40.990: ERROR/IMemory(679): binder=0x238aa8 transaction failed fd=-2147483647, size=0, err=-2147483646 (Unknown error: 2147483646)
40.990: ERROR/IMemory(679): cannot dup fd=-2147483647, size=0, err=-2147483646 (Bad file number)
40.990: ERROR/IMemory(679): cannot map BpMemoryHeap (binder=0x238aa8), size=0, fd=-1 (Bad file number)
40.990: ERROR/Surface(679): Couldn't map Surface's heap (binder=0x238aa8, heap=0x238b00)
40.990: DEBUG/AndroidRuntime(679): Shutting down VM
40.990: WARN/dalvikvm(679): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
40.990: ERROR/AndroidRuntime(679): Uncaught handler: thread main exiting due to uncaught exception
40.990: ERROR/AndroidRuntime(679): java.lang.IllegalArgumentException
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvasNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at android.view.Surface.lockCanvas(Surface.java:196)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.draw(ViewRoot.java:1175)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.performTraversals(ViewRoot.java:1030)
40.990: ERROR/AndroidRuntime(679): at android.view.ViewRoot.handleMessage(ViewRoot.java:1482)
40.990: ERROR/AndroidRuntime(679): at android.os.Handler.dispatchMessage(Handler.java:99)
40.990: ERROR/AndroidRuntime(679): at android.os.Looper.loop(Looper.java:123)
40.990: ERROR/AndroidRuntime(679): at android.app.ActivityThread.main(ActivityThread.java:3948)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invokeNative(Native Method)
40.990: ERROR/AndroidRuntime(679): at java.lang.reflect.Method.invoke(Method.java:521)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
40.990: ERROR/AndroidRuntime(679): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
40.990: ERROR/AndroidRuntime(679): at dalvik.system.NativeStart.main(Native Method)
41.000: INFO/Process(576): Sending signal. PID: 679 SIG: 3
41.000: INFO/dalvikvm(679): threadid=7: reacting to signal 3
41.030: ERROR/ActivityThread(576): Failed to find provider info for android.server.checkin
41.030: ERROR/Checkin(576): Error reporting crash: java.lang.IllegalArgumentException: Unknown URL content://android.server.checkin/crashes
41.070: INFO/dalvikvm(679): Wrote stack trace to '/data/anr/traces.txt'
50.940: WARN/ActivityManager(576): Launch timeout has expired, giving up wake lock!
50.980: WARN/ActivityManager(576): Activity idle timeout for HistoryRecord{4366ac40 {com.android.launcher/com.android.launcher.Launcher}}
sounds to me more like something wrong with your emulator. Why dont you delete your emulator and create a new one and try again with a fresh project.
Hope that will help you. BTW why are you using emulator on 1.5?? Start to build applications for min 2.1.
Good luck.

Out of memory error when using Google Maps API

I have an application here that has a feature of showing a POI on the map. It's only one POI and it is only drawn when it's actually within the visible screen area. It works perfectly for a while but if I play around zooming in and out and dragging, it will eventually crash. According to Logcat, the reason is always an OutOfMemory error.
At first, I thought it was a bug on the Google Maps API. After some researching and seeing some Romain Guy posts, I was kind of convinced that I had done something stupid on my app that kept me running out of memory from time to time.
Then I ran some more detailed tests with Heap Analyzer (Eclipse) on and I saw that even though I had 2+, sometimes 3+ megabytes left of free memory, I was still getting those annoying Force Close messages caused by OutOfMemoryError. Most of the times it crashes when trying to allocate some 614kb chunk of memory regardless of how much I have left.
This problem happens a lot on Nexus One 2.2.1 and on HTC Evo 2.1. After some little testing, I got no crash neither on G1 1.6 nor Samsung Galaxy S i9000 2.1. But I cannot say for sure the G1 and Galaxy will not show this problem after more testing.
I can only think of a memory fragmentation problem. I hope this problem has a solution. I will also be glad if I can just catch this error and prevent the app from crashing.
If it helps, here's the logcat:
09-29 08:58:06.661: ERROR/dalvikvm-heap(1552): 648000-byte external allocation too large for this process.
09-29 08:58:06.661: ERROR/dalvikvm(1552): Out of memory: Heap Size=9991KB, Allocated=6980KB, Bitmap Size=14510KB
09-29 08:58:06.661: ERROR/(1552): VM won't let us allocate 648000 bytes
09-29 08:58:06.672: DEBUG/AndroidRuntime(1552): Shutting down VM
09-29 08:58:06.672: WARN/dalvikvm(1552): threadid=3: thread exiting with uncaught exception (group=0x4001b390)
09-29 08:58:06.672: ERROR/AndroidRuntime(1552): Uncaught handler: thread main exiting due to uncaught exception
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): java.lang.OutOfMemoryError: bitmap size exceeds VM budget
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.graphics.Bitmap.nativeCreate(Native Method)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.graphics.Bitmap.createBitmap(Bitmap.java:569)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.google.android.maps.ZoomHelper.createSnapshot(ZoomHelper.java:422)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.google.android.maps.ZoomHelper.beginZoom(ZoomHelper.java:186)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.google.android.maps.MapView$2.onScaleBegin(MapView.java:371)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ScaleGestureDetector.onTouchEvent(ScaleGestureDetector.java:208)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.google.android.maps.MapView.onTouchEvent(MapView.java:646)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.View.dispatchTouchEvent(View.java:3709)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:874)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:924)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1701)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1116)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.app.Activity.dispatchTouchEvent(Activity.java:2068)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1685)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.view.ViewRoot.handleMessage(ViewRoot.java:1708)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.os.Handler.dispatchMessage(Handler.java:99)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.os.Looper.loop(Looper.java:123)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at android.app.ActivityThread.main(ActivityThread.java:4595)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at java.lang.reflect.Method.invokeNative(Native Method)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at java.lang.reflect.Method.invoke(Method.java:521)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
09-29 08:58:06.681: ERROR/AndroidRuntime(1552): at dalvik.system.NativeStart.main(Native Method)
I have been running into this problem on and off for the past month. The way I've worked around the issue in my code is by forcing the GC to clean up unreferenced bitmaps that I have wrapped in WeakReferences. This approach might not work for you since the crash that you pasted above seems to originate in the MapView. Regardless, try to sprinkle some System.gc() calls in key locations in your code and watch the system Log to see if the GC_EXPLICIT messages indicate a lot of objects/bytes freed. In the code I'm working on I've had to add a System.gc() at the end of my Adapter.getView() method to ensure that unused bitmaps are cleaned up by the next time getView() is called. This approach seems to have drastically reduced my run in with the
dreaded java.lang.OutOfMemoryError: bitmap size exceeds VM budget crash.
I have been having this EXACT same problem, I salted the code with some System.GC calls and it seemed to help a little bit, but this still happens.
I am also getting another problem which might be related where the map seems to flip out and go all random when you pinch zoom. This tends to happen sometimes before a crash.
This is all only happening only on an HTC Desire which I believe is the same phone as the Nexus One under the hood. (and similar in many ways to the EVO which also suffers from it).
Note: It is working 100% fine on our Arc-S, Galaxy V1, AVD emulator and Asus tablet.
I had the same problem , add the following line in manifest file under application tag
android:largeHeap = true . This worked for me

Categories

Resources