Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android performance api level 11 and above

I seem to have an unsolvable issue, I have spent the weekend on it, couldn't get it fixed. When I make a simple test app with two activities: 1. Mainactivity: a few buttons, a timer (background thread) and a light request to a SQLite db. 2. Second activity: a few buttons, only one has a on click listener, when you click it, you simply go back to the first activity. I use large buttons (screen width about a quarter of the screen height), the xml layout resources do not contain any nested weight-elements or other exotic things.

It is a test project, it has no other functionality.

I'm having the following serious issue: -when I set the api level in the manifest file to 3, everything works perfect. (screen automatically in compatibility mode) -when I set the api level 11 or higher, it can take up to 10 seconds for the second activity to load. After the first time opening the second activity, things seem to be cached, the delay no longer exists. -when I set the api level to 11 or higher, and I force (screen res) compatibility mode: no change, the delay remains.

I've build this test project because I ran into this issue when upgrading an older app. It ran smoothly on older api levels, whenever I put it to Android version 3 or higher, it gets delays up to 25 seconds! (even for opening an activity that shows static text only...).

I am testing on a new Galaxy Tab, that cannot be the problem. I have spent hours googling for a solution,never found anything close to it. I even completely de-installed Eclipse and all android resources and had everything fresh installed and updated (including a factory reset of my Galaxy Tab). No luck.

I did a trace, the problem is in GLES20Canvas.nDrawDisplayList. It seems that building this list takes a lot of time, even when there is not much to build...

Does anyone have a clue on how I can solve this?

Thanks, Martin

like image 874
martin Avatar asked Dec 11 '12 12:12

martin


People also ask

What is the API level of Android Version 11?

Android 11 (API level 30)

What is API 19 or above?

Android api level 19 means the android os version (kitkat). It contains the standard android packages(from Android Open Source Projects).

What is the difference between Android 11 and 12?

At a glance, Android 12 is more customizable and personalized for you, and has a heavier focus on performance and privacy than Android 11. If you're familiar with Apple's personalization tools in its latest iOS versions, that seems to be what Google is trying to emulate in its latest Android version.


2 Answers

I've found a solution to this issue by examining this post: http://code.google.com/p/android/issues/detail?id=22514

The solution is to disable hardware acceleration.

In the AndroidManifest.xml, in your application tag, add:

android:hardwareAccelerated="false"

Now everything runs smooth again. Unfortunately hardware acceleration doesn't make your app run faster when it starts.

like image 160
martin Avatar answered Oct 17 '22 08:10

martin


GLES20Canvas.nDrawDisplayList

when this comes it is expected to have a large portion of the time if you are drawing a lot, especially very big views.

I would like you give you link for the Do's and Dont's from android-30-hardware-acceleration

like image 34
Bhavesh Patadiya Avatar answered Oct 17 '22 09:10

Bhavesh Patadiya