donderdag 16 oktober 2014

Robolectric + Google Play Service 5.x = java.lang.VerifyError

When I upgraded my application recently to include Play Services 5.x (for Wearable integration) I ran into the infamous VerifyError.

Thanks to this Google post, I could easily fix the issue.

In short, when you have this in your build file:
...
    //keep GMS play services at 4.4, 5.x only works with support-v4:21.+
    //compile 'com.google.android.gms:play-services:4.4.52'
    compile 'com.google.android.gms:play-services-wearable:5.0.77'

    compile 'org.bouncycastle:bcprov-jdk16:1.46'
...

Make sure to include:
tasks.whenTaskAdded { theTask ->
    def taskName = theTask.name.toString()
    //map "testLocalDebug" to your taskName!!
    if ("testLocalDebug".toString().equals(taskName)) {
        /**
         * Listen for when robolectric adds the 'testDebug' task and when it does, add the -noverify
         * option to that task's jvmArgs.  This allows us to turn off byte code verification when
         * running our unit tests.
         */
        theTask.jvmArgs('-noverify')
    }
}

To avoid:
java.lang.VerifyError: Expecting a stackmap frame at branch target 69
Exception Details:
  Location:
    com/google/android/gms/gcm/GoogleCloudMessaging.()V @31: goto
  Reason:
    Expected stackmap frame at this location.
  Bytecode:
    0000000: b801 b54c 2ab7 011d 2ab6 0120 1301 2203
    0000010: 1202 b801 284d 2cc7 000b 2b10 2c04 54a7
...


1 opmerking:

  1. 1XBet
    Betting in India. It can be great to find the most popular brands, especially 1xbet korean ones that offer betting on sports such as titanium metal trim football, tennis,  Rating: 1/10 · หาเงินออนไลน์ ‎Review by 바카라 사이트 Riku VihreasaariWhere can I find 1xbet?Where 바카라 사이트 can I find 1xbet betting?

    BeantwoordenVerwijderen