Home:ALL Converter>java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/maps/GeoPoint

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/maps/GeoPoint

Ask Time:2017-08-20T17:16:35         Author:user7913931

Json Formatter

I'm trying to get latitude and longitude from address through this method:-

public GeoPoint getLocationFromAddress(String strAddress){

    Geocoder coder = new Geocoder(this);
    List<Address> address;
    GeoPoint p1 = null;

    try {
        address = coder.getFromLocationName(strAddress,5);
        if (address==null) {
            return null;
        }
        Address location=address.get(0);
        location.getLatitude();
        location.getLongitude();

        p1 = new GeoPoint((int) (location.getLatitude() * 1E6),
                (int) (location.getLongitude() * 1E6));

        return p1;
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

But I got this error:-

java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/maps/GeoPoint

What am I missing here?

My full error:-

Process: breamex.happy_week_end, PID: 22803 java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/maps/GeoPoint; at breamex.happy_week_end.search.SearchActivity.getLocationFromAddress(SearchActivity.java:439) at breamex.happy_week_end.search.SearchActivity.search(SearchActivity.java:357) at breamex.happy_week_end.search.SearchActivity.access$000(SearchActivity.java:76) at breamex.happy_week_end.search.SearchActivity$1.onClick(SearchActivity.java:189) at android.view.View.performClick(View.java:5610) at android.view.View$PerformClick.run(View.java:22265) at android.os.Handler.handleCallback(Handler.java:751) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:154) at android.app.ActivityThread.main(ActivityThread.java:6077) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) Caused by: java.lang.ClassNotFoundException: Didn't find class "com.google.android.maps.GeoPoint" on path: DexPathList[[zip file "/data/app

My full Gradle:-

 apply plugin: 'com.android.application'

android {
    compileSdkVersion 'Google Inc.:Google APIs:24'
    buildToolsVersion '25.0.3'
    defaultConfig {
        applicationId "app"
        minSdkVersion 15
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        vectorDrawables.useSupportLibrary = true
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile project(':stepper')
    compile project(':slider')
    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.google.firebase:firebase-messaging:10.2.0'
    compile 'org.greenrobot:eventbus:3.0.0'
    compile 'com.facebook.android:facebook-android-sdk:4.22.0'
    compile 'com.mcxiaoke.volley:library-aar:1.0.0'
    compile 'com.google.android.gms:play-services:10.2.0'
    compile 'com.google.android.gms:play-services-maps:10.2.0'
    compile 'com.google.android.gms:play-services-auth:10.2.0'
    compile 'com.google.firebase:firebase-auth:10.2.0'
    compile 'com.android.support:support-v4:26.+'
    compile 'com.github.bumptech.glide:glide:4.0.0-RC1'
    compile 'de.hdodenhof:circleimageview:2.1.0'
    compile 'com.jakewharton:butterknife:8.6.0'
    testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

Author:user7913931,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/45780465/java-lang-noclassdeffounderror-failed-resolution-of-lcom-google-android-maps-g
yy