简体   繁体   中英

AbstractMethodError for LocationListener even app built with compileSdkVersion 30

Below exception is getting thrown for some devices which has Android 9 (API level 28).

Fatal Exception: java.lang.AbstractMethodError: abstract method "void android.location.LocationListener.onStatusChanged(java.lang.String, int, android.os.Bundle)"

With this cause seems I am missing some fundamental concepts, as per my assumption app shouldn't throw this exception as app built with compileSdkVersion 30 meaning that we don't need to override default methods defined in LocationListener .

Please help me to understand above issue.

If we had to override to avoid above issue then seems issues is with Android SDK.

EDIT: Here is the update from Google team

https://issuetracker.google.com/issues/190695723

you use locationListenerCompat,later succesfully

I guess the issues is on Android SDK, on Sdk Version 29 below needed to override this.

@Override
public void onStatusChanged(String provider, int status, Bundle extras) {
    
}

One solution is to override the onStatusChanged(), but you can also use the new LocationListenerCompat interface.

You can read this answer here for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM