Android OpenGL app randomly reboots phone - android

I am developing an OpenGL application and testing it on Xperia 10 Mini (Android 2.1). After launching it and using it for some time the phone reboots (every time).
I have tried saving logcat to separate file, with no findings and also adb bugreport (I am not sure what to look for in that one. I found only some wlan related kernel Oops).
I am suspicious of opengl texture management or concurency. Here I am looking for any advice on how to debug the application and also for some tips on where to look for the problem.

Check your app for a memory leak. My second guess would be to check which OpenGL ES Version you are using (GL10 vs. GL20). The latter is not (fully) supported on Android 2.1 AFAIK.

Related

Is 12 Android emulator safe for PC?

In Android Studio (version: Android Studio Dolphin 2021.3.1 Patch 1) before downloading virtual image with Android 12 (API 33, Tiramisu) I had to agree to the license agreement that start with the following worrying me statement:
To get started with the Android SDK Preview, you must agree to the
following terms and conditions. As described below, please note that
this is a preview version of the Android SDK, subject to change, that
you use at your own risk. The Android SDK Preview is not a stable
release, and may contain errors and defects that can result in serious
damage to your computer systems, devices and data.
The same for 32 API (Android 11). For Android 7 there was no such warning.
Is it safe now to install and use this emulators? What damage can happen to computer? How to prevent it? Does someone already install and use them?
In the similar question I found the following recommendations about potential overheating PC:
It could potentially damage your laptop if it overheats. But that is
why the fan is running. It is trying to cool down. If it gets too hot
your computer will start throttling programs, apps and processes to
try and cool down. And if it gets too hot it should shut itself down
to prevent damage. Make sure to keep and vents and fans clear, clean
and free for airflow.
This is the only main problem with this emulators?
Any emulator is doing something the pc isn't handled to do, this goes double for mobile apps. Worst case scenario I had with emulating a G phone was that when closing the app the pc would slowly start to crash which I would need to restart in order to get it working normally (also the lack of space on the ssd made a problem too) but no major damage was made. Of course don't neglect your pc, the more you complex stuff you try to emulate the more your pc will gasp for air, give it some breathing room now and then, take a break and keep going. If for example you are using flutter dart has a nice API that you can use online that won't effect your pc at all.
Also this goes triple for laptops since most don't have that good of a cooling.
I tried to install 33 API (Tiramisu) emulator on Notebook ThinkPad T420 (processor: i5-2520M CPU 2.50GHz, memory: 8 Gb, SSD) with enabled virtualization. Emulator boots about 8 minutes. Works terribly slow. Always reads or writes something to SSD (since memory is not enough it is using swap). Not possible to use. Temperature of CPU is near to critical level: ~90°C.
PC must have more resources otherwise there is real risk to damage it.

GPGPU Android Emulator (Renderscript / OpenCL)

More specifically, I'm wanting to run OpenCL / Renderscript code in an Android Emulator that actually runs on my computer's GPU instead of CPU. Unluckily I'm using an AMD CPU and GPU.
I know that AMD has OpenGL ES support (and everything supports OpenCL pretty much) via SDKs but that's as far as I've gotten on that front - the only OpenCL / Renderscript information I've found regarding emulators is that they either don't work at all or, if I had an Intel CPU, I could install OpenCL in the emulator but it would only use the CPU (and frankly I wouldn't be surprised if behind the scenes my emulator(s) aren't already doing this - OpenCV runs without incident but OpenCL-Z says there's no OpenCL support).
Is there some way to send the commands from the emulator to my OS and have it automatically run? The only ways I've come up with involve saving and loading a text file which isn't likely to be faster (or good for my hard drive) given I'm running 2 Emulator Instances.
I found some mention of RenderScript being supported in the official emulator but said emulator isn't meant for my use-case and I strongly doubt that it's going to use my GPU.
I'm using Memu at the moment because Bluestacks 3 uses more resources when running 2 instances and the 2nd instance doesn't work very well with adb commands / root for some reason - it thinks it's working but it doesn't do anything. If there's a faster emulator when it comes to running 2 instances I'm sure it would help but oddly enough comparing them is difficult and time consuming (especially when every one of them is like "No, I'M the fastest - look at MY bar graphs!" lol) and ultimately I believe my problem to be with OpenCV not getting GPU acceleration (because it runs much faster on my phone) and not the emulator's base speed.
I have AMD's virtualization features enabled (confirmed with Leomoon or w/e) and they're enabled in the manager for Memu. Perhaps this is already working behind the scenes, then? Either way, emulation costs increase by 10% per instance once the OpenCV stuff comes into play (taking it from 60 to 80%+)
Use a language (like Python) and send commands via ADB. Python can hook into OpenCL and OpenCV; ADB can be used to get the Framebuffer for screenshots or Python can just capture the emulator's window render.
Alternatively, a connection can be made using SocketIO (Flask Socket IO and Javascript's client socket IO in my case) and they can communicate that way. Confirmed via the browser on the emulator and real device. Every emulator has ports to communicate to your native OS. I ultimately chose not to go this route as it's a little convoluted (2 servers, different languages, no better than ADB over LAN) but it's an option. Java (iirc) also runs SocketIO just fine and would likely be a decent option for many devs who are familiar with the language and wish to run some stuff natively on Android Devices.
Feeling physically ill atm and typing on a phone so my apologies for the present lack of examples and assistance. Hopefully I can catch the time to address this but, frankly, there are few use cases for this outside of the one I'm presently targeting and it's quite niche to begin with.

Which device are supported for unity?

I am very new with unity. When I'm trying o run the project after the following the document, it does not run force close with hardware is not supported.
Simple blue screen with camera focus show at run in unity but in
device it can't.
In emulator it shows error like:
08-02 12:29:47.672: ERROR/libEGL(305): called unimplemented OpenGL ES API
In device it shows:
Insatisfylinked
What should I do? Is there some device compatibility?
Check this link for a list of devices that have been tested with Unity.
According to this post (in which the author had the same problem as you) it is possible to get Unity running on the Android emulator, but performance is very poor.
Unity CAN run on an emulator (use emulator mode when compiling) it just runs slow. On my phone (HTC legend, which is listed as incompatible), it runs slow and there's no sound, but it does work.
I think it's because for some odd reason or another, certain manufacturers didn't choose to support OpenGL on certain models.
WIndows 8 and WIndows 8 phone will be supported when released as well!

How to test application based on Open GL ES 2.0?

Will I be able to test my Open GL ES 2.0 application on Android Emulator? Or I will have to use Android 2.2 device to test it? What devices are best to test applications on it? I know that official Dev Phones are Nexus One and ADP 2 (as you can see on this website http://developer.android.com/index.html) but Im asking about your experience with other devices too.
You have to test those applications only on real devices. Emulator doesn't support OGL ES 2.0. You can also use remote testing devices (look at Motodev Studio, there is some of support for this).
There is no noticeable differences between dev phone and "standard" phone, if you are application developer.
It's hard to tell what's the best choice, cause there are so many devices now, and they just keep coming. Also you might think about testing your app on a tablet, if you consider designing for tablets, so here's a another problem of choice. Phones and tablets are very different in terms of performance, so you won't choose an ideal phone for testing. Testing on the emulator is also a waste of time with an OpenGL application, especially if it's dynamic, cause emulator will give you a very low FPS rate and very slow responsiveness.

Missing OpenGL drivers on Android emulator

I am trying to set up an Android emulator to do some playing around with OpenGL ES on it, but I am stymied by the fact that, every time I run my program on it, it unceremoniously grenades itself. The problem (at least the first nasty red error line in the log) is a missing package called libhgl.so. This is the OpenGL driver file required for running OpenGL ES on Android devices, but for some reason, my emulator doesn't have it. Does anyone know where I can get drivers for the emulator, or how to get an emulator that already has them?
In this link:
http://osdir.com/ml/android-porting/2009-06/msg00282.html
it says:
libEGL.so and libGLESv2.so implements EGL and OpenGL ES through
libhgl.so and libagl.so. That is, libhgl.so and libagl.so are
dlopen()ed by libEGL.so. All EGL and OpenGL ES calls will finally call
into libhgl.so and/or libagl.so.
and here:
http://osdir.com/ml/android-porting/2009-06/msg00288.html
libagl.so is an pure software impl. For your accelerated impl., you
need to provide libhgl.so so that libEGL.so will be able to use it. It
is expected that libhgl.so implements and exports both eglXXX and glXXX
symbols.
I guess that indicates that the missing file will only exist on the device itself, but that the app should run with the software driver on the emulator. The numerous screenshots on the web of OpenGL apps on the Android emulator also indicates that OpenGL should work fine on the emulator. Any other possible reasons why you are not able to get OpenGL going?
The logic of loading EGL user space driver is at frameworks/native/opengl/libs/EGL/Loader.cpp. Basically there are three cases:
Running with emulator in software rendering mode
Running with emulator in OpenGL mode. This is where libhgl.so is loaded for earlier version of Android.
Running with actual device.
The emulator coming with ADT does not work well for case 2. But emulators are improved over recent years. You can use latest Android Studio which has a better emulator or leapdroid at http://www.leapdroid.com/

Categories

Resources