I am trying to make an app that needs to get the current gps location. The app crashes everytime i try. Kindly look into this : I am following this tutorial:I am following this tutorial: https://developer.android.com/training/location/retrieve-current.html.
I have tried following youtube videos which ultimately failed. 
The app works fine when i comment out the code that implements locationlistener,locationcallbacks, and all the code that runs for getting location.

This is my manifest file:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="tc.elicz.roadpal">
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
     </application>

    </manifest>

This is my main_activity.java file:

    package tc.elicz.roadpal;
    import android.Manifest;
    import android.app.Dialog;
    import android.content.DialogInterface;
    import android.content.Intent;
    import android.content.pm.PackageManager;
    import android.location.Location;
    import android.location.LocationListener;
    import android.location.LocationManager;
    import android.os.Build;
    import android.provider.Settings;
    import android.support.annotation.NonNull;
    import android.support.v4.app.ActivityCompat;
    import android.support.v7.app.AlertDialog;
    import android.support.v7.app.AppCompatActivity;
    import android.os.Bundle;
    import android.widget.Button;
    import android.widget.TextView;
    import com.google.android.gms.common.api.GoogleApi;
    import com.google.android.gms.common.api.GoogleApiClient;
    import com.google.android.gms.location.LocationRequest;
    import com.google.android.gms.location.LocationServices;
    import com.google.android.gms.common.api.GoogleApiClient.ConnectionCallbacks;
    import org.xml.sax.helpers.LocatorImpl;
    import java.util.Map;
    import static com.google.android.gms.location.LocationServices.FusedLocationApi;

    public abstract class MainActivity extends AppCompatActivity implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener{
    private Button button;
    private TextView textView1;
    private LocationManager locationManager;
    private LocationListener locationListener;
    private GoogleApiClient mapo = null;
    private Location lastloc = null;
    private String lat = null;
    private String lon = null;
        private LocationRequest locreq= new LocationRequest();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        System.out.println("sosll");
        setContentView(R.layout.activity_main);
        textView1 = (TextView) findViewById(R.id.textView);

        if (mapo == null) {
            mapo = new GoogleApiClient.Builder(this)
                    .addConnectionCallbacks(this)
                    .addOnConnectionFailedListener(this)
                    .addApi(LocationServices.API)
                    .build();
        }


    }

    protected void onStart() {
        super.onStart();
        mapo.connect();

    }

    protected void onStop() {
        super.onStop();
        mapo.disconnect();

    }

    @Override
    public void onConnected(Bundle connectionHint) {
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
            textView1.append("No permission");
            System.out.println("No perm");
            return;
        }
        lastloc = LocationServices.FusedLocationApi.getLastLocation(
                mapo);
        if (lastloc != null) {
            lat=(String.valueOf(lastloc.getLatitude()));
            lon=(String.valueOf(lastloc.getLongitude()));
            textView1.append("Lat:" + lat +"lon:" +lon);
        }
    }
    }

I also made some changes to the gradle file as per the tutorial. So her it is:

    apply plugin: 'com.android.application'

    android {
        compileSdkVersion 24
        buildToolsVersion "24.0.3"
        defaultConfig {
            applicationId "tc.elicz.roadpal"
            minSdkVersion 22
            targetSdkVersion 24
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner
    "android.support.test.runner.AndroidJUnitRunner"
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
            exclude group: 'com.android.support', module: 'support-annotations'
    })
        compile 'com.android.support:appcompat-v7:24.2.1'
        testCompile 'junit:junit:4.12'
        compile 'com.google.android.gms:play-services:11.0.4'
    }
