Search code examples
javaandroidgoogle-maps-api-2

java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation google maps


I know this error has several threads but I have not been able to find a fix that matches my situation. I am currently dealing with a "java.lang.IllegalAccessError: Class ref in pre-verified class resolved to unexpected implementation" error pointing to the following code

    private GeoPoint mapGeoCenter = new GeoPoint(0, 0);

Now we have stopped using Google Maps API 1 but we still have some random lines of code that reference the old API. I thought this was the area of issue but my coworker claims that it is working for him fine and my environment is the thing that is setup incorrectly.

From what I gather from the internet is that this error occurs when you reference two of the same libraries. But from what I have in my build.gradle I dont see anything that would validate that this is indeed the problem.

dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile files('jars/FLurry_3.2.2.jar')
compile files('jars/gson-2.2.4.jar')
compile files('jars/zxing.jar')
compile files('ant_lib/android-10/maps.jar')
compile files('libs/nineoldandroids-2.4.0.jar')


compile 'com.android.support:appcompat-v7:19.+'
androidTestCompile 'junit:junit:4.10'
androidTestCompile 'org.robolectric:robolectric:2.3'
compile project(':android-volley-master')

compile(name: 'library-2.4.1', ext: 'aar')

Solution

  • I ran into this error because I was including maps.jar as a dependency. Taking out maps.jar and compiling against the Google APIs fixed it:

    android {
    compileSdkVersion "Google Inc.:Google APIs:21"
    ...
    }