2

I keep reading about the verifyError exception, but I can't seem to find a good solution for my problem.

The logs give me the following error:

Caused by: java.lang.VerifyError: Verifier rejected class mypackage.GraphThready: void mypackage.GraphThready.run() failed to verify: void mypackage.GraphThready.run(): [0x50BE] copy1 v2<-v398 type=Undefined cat=1 (declaration of 'mypackage.GraphThready' appears in /data/app/mypackage-2/split_lib_slice_9_apk.apk)

I don't know if it is because my class, mypackage.GraphThready is declared twice or perhaps the fact that I am testing my app on Android device with API 24(version number 7.0)

Here is what part of the app gradle file looks like:

compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
    applicationId "mypackage"
    minSdkVersion 16
    targetSdkVersion 26
    versionCode 2
    versionName "2.0"
    multiDexEnabled true

Perhaps I should change 'compiledSdkVersion' to 24? Any suggestions.

4
  • General rule of thumb is to restart Android Studio with file -> invalidate caches & restart. Commented Jul 10, 2018 at 8:44
  • I tried that already @IoaneSharvadze Commented Jul 10, 2018 at 8:45
  • Also, downgrading compileSdkVersion is not a good option, since you won't be able to use new API's. Try upgrading instead. Upgrade build tools, Android Studio, Gradle Version. Commented Jul 10, 2018 at 8:45
  • Set buildToolsVersion '27.0.3' compatible to compileSdkVersion 26. Upgrade the compileSdkVersion , targetSdkVersion to 27. Commented Jul 10, 2018 at 9:03

1 Answer 1

0

After much reading, updating and compiling my android app, I found out that I was not adding proper multi-dex support. It turns out all I had to do was increase the minSdkVersion in my gradle file to at least 21(Lollipop devices). According to the Android device Dashboard found here https://developer.android.com/about/dashboards/ about 10.3% of Android devices run KitKat which is a huge percentage of the lower level API's(<21). I am assuming is a world-wide figure not related to API level distribution in Android devices here in the USA, which is market where I will release the app. So, I changed minSdkVersion to 21 and kept the multiDexEnabled = true in the gradle file, and the error disappeared. For those that supporting pre-Lollipop devices and wish to add multi-dex support click here https://developer.android.com/studio/build/multidex It will show you exactly what to do, which is not very difficult.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.