Why does instantiating a Gson object throw java.lang.VerifyError?
<p>I have inherited a project and have been migrating it from the original Eclipse workspace to Android Studio.</p>

<p>For some reason when the following code causes an exception:</p>

<pre><code>Gson gson = new Gson();
</code></pre>

<p>Stack trace:</p>

<pre><code>java.lang.VerifyError: com/google/gson/Gson
    at com.example.example.activities.LoginActivity.onCreate(LoginActivity.java:59)
    at android.app.Activity.performCreate(Activity.java:5264)
    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1088)
    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2302)
    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2390)
    at android.app.ActivityThread.access$800(ActivityThread.java:151)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1321)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5292)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
    at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>This occurs on two 4.4.2 devices but not on 5.1.1.</p>

<p>I have tried:</p>

<ul>
<li>Using an older version of the GSON library</li>
<li>Repackaging the library (<a href="http://cases.azoft.com/fix-verifyerror-android-apps-gson-library/" rel="nofollow">http://cases.azoft.com/fix-verifyerror-android-apps-gson-library/</a>)</li>
</ul>