Its been a year I was inactive with android development. Earlier I used to develop apps using adt-bundle eclipse. Recently I started working with Android studio. I have migrated my application code by creating new files in android studio project and copied code, also made some changes in manifest and newly introduced build.gradle files.
First I got error, java.lang.OutOfMemoryError
So I've added following in manifest file, android:largeHeap="true"
This problem is resolved then.
Later I removed inherited class ActionBarActivity from activity classes, and inherited AppCompatActivity .
Also added following in bundle.gradle
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services-ads:8.3.0'
}
now I'm getting following errors,
I/Choreographer: Skipped 158 frames! The application may be doing too much work on its main thread.
E/SpannableStringBuilder: SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
Is the problem arising due to following use of findViewByID
(EditText) findViewById(R.id.editText1);
(EditText) findViewById(R.id.editText2);
(EditText) findViewById(R.id.editText3);
(Spinner) findViewById(R.id.spinner1);
(EditText) findViewById(R.id.editText4);
The main problem is, app is running very slow!!!
Not sure if you are having the same issue as mine. Mine was because my app has a configuration in AndroidManifest that says android:hardwareAccelerated="false"
This doesn't cause any lag issue in the old UI, but I am thinking that maybe with the new material design UI effects it introduces some lag unless we use hardware acceleration.
Try removing android:hardwareAccelerated="false" or set it to true to see if it still lags when responding to your touches. It solves mine.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.