I have a problem running my android app on Lollipop 5.0 devices.
When i build a release apk it works fine on all the devices I tested (Android 6,7 and 4). It used to work on my 5.0 device as well a few weeks ago and I can't remember to have changed anything significant. It is a LG G3.
The error I get is:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.duke.privatpc.quiztest, PID: 2758
java.lang.VerifyError: Rejecting class com.duke.privatpc.quiztest.Splash because it failed compile-time verification (declaration of 'com.duke.privatpc.quiztest.Splash' appears in /data/app/com.duke.privatpc.quiztest-2/base.apk)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.Class.newInstance(Class.java:1572)
at android.app.Instrumentation.newActivity(Instrumentation.java:1065)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2206)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2365)
at android.app.ActivityThread.access$800(ActivityThread.java:148)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1283)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5272)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:909)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:704)
04-02 12:09:20.038 1014-2108/? I/art: Explicit concurrent mark sweep GC freed 26780(1315KB) AllocSpace objects, 1(16KB) LOS objects, 30% free, 73MB/105MB, paused 1.223ms total 163.987ms
I found some threads about a similar problem, but none of the tips helped. I tried turning of instant run or cleaning the project, but nothing seems to work. The app closes right after launching it.
My Gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.duke.privatpc.quiztest"
minSdkVersion 16
targetSdkVersion 23
versionCode 5
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
mavenCentral()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':BaseGameUtils')
compile 'com.anjlab.android.iab.v3:library:1.0.+'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.firebase:firebase-ads:10.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
The Activity itself is about 22.000 lines as i instantiate a lot of objects. Mainly it is one method, creating 2000 Questions for a Quiz. I know this is neither beautiful code nor the best way to do it as I could have used a database, but I'm at a point where I don't really want to rewrite a big part of the app. Mainly I want to know if this can be caused by having a method that is too big and if there is any way to optimize it?