Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

java.lang.NoSuchMethodError: android.location.Location.getElapsedRealtimeNanos (Android) #2009

Closed

Description

@mb12

Ran into this crash today. My repo doesn't have latest changes done by @bleege to move location tracking into the SDK. Filing this for tracking since it looks like a bug in third party library.

E/AndroidRuntime(28567): FATAL EXCEPTION: main
E/AndroidRuntime(28567): java.lang.NoSuchMethodError: android.location.Location.getElapsedRealtimeNanos
E/AndroidRuntime(28567):    at com.mapzen.android.lost.internal.FusionEngine.isBetterThan(FusionEngine.java:163)
E/AndroidRuntime(28567):    at com.mapzen.android.lost.internal.FusionEngine.onLocationChanged(FusionEngine.java:131)
E/AndroidRuntime(28567):    at android.location.LocationManager$ListenerTransport._handleMessage(LocationManager.java:237)
E/AndroidRuntime(28567):    at android.location.LocationManager$ListenerTransport.access$000(LocationManager.java:170)
E/AndroidRuntime(28567):    at android.location.LocationManager$ListenerTransport$1.handleMessage(LocationManager.java:186)
E/AndroidRuntime(28567):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(28567):    at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(28567):    at android.app.ActivityThread.main(ActivityThread.java:4745)
E/AndroidRuntime(28567):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(28567):    at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(28567):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(28567):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
E/AndroidRuntime(28567):    at dalvik.system.NativeStart.main(Native Method)

Activity

  1. added
    Android
    on Aug 6, 2015
  2. added this to the milestone on Aug 6, 2015
  3. bleege commented on Aug 6, 2015

    @bleege
    Contributor

    Thanks for reporting this @mb12. Can you describe what device you saw this on as well as which version of Android it's running on?

    Looking at the LOST source code it's using an internal SystemClock class that does an Android version check before attempting to call this method. The check requires JELLY_BEAN_MR1 (API 17) or higher which is the same API level when the method was added to the Android API.

  4. mb12 commented on Aug 6, 2015

    @mb12
    Author

    Android 4.1.2.

  5. ljbade commented on Aug 7, 2015

    @ljbade
    Contributor

    That's stock Jelly Bean aka API 16.

    @mb12 what device is this? And what API level does it report via the version check? You should be able to debug this easily since it all in Java.

  6. ljbade commented on Aug 7, 2015

    @ljbade
    Contributor

    @bleege Actually I think that was a bug fix in LOST. Perhaps we need to update the dependency.

  7. ljbade commented on Aug 7, 2015

    @ljbade
    Contributor

    OK looking at the git tags 1.0.1 should have this fix.

  8. ljbade commented on Aug 7, 2015

    @ljbade
    Contributor

    We are using that version.

    @mb12 have you tried cleaning or just a fresh git clone incase your build is somehow still using an old version of LOST?

  9. mb12 commented on Aug 7, 2015

    @mb12
    Author

    I commented the tracking code to work around it. I just need a vanilla base map. #1702 is blocking me. Is it possible for someone to analyze it?

  10. bleege commented on Aug 26, 2015

    @bleege
    Contributor

    @mb12 So it looks like this is getting caught on the different flavors of Jelly Beans. The phone should say API 16 and thus be ok with LOST, but it sounds like it might be a bit confused. To help us get to the bottom of this can you confirm what version the phone thinks it is by running the following code:

    int version = Build.VERSION.SDK_INT
    
    System.out.println("version = " + version);
    
    if (version == Build.JELLY_BEAN) {
      System.out.println("I'm regular Jelly Bean");
    } else if (version == Build.JELLY_BEAN_MR1) {
      System.out.println("I'm Jelly Bean MR1");
    } else if (version == Build.JELLY_BEAN_MR2) {
      System.out.println("I'm Jelly Bean MR2");
    } else {
      System.out.println("I'm not Jelly Bean.");
    }
  11. mb12 commented on Aug 26, 2015

    @mb12
    Author

    @bleege Why does this matter? The min supported version is API level 15 (ICS). Jelly Bean/MR1/MR2 are all higher than API Level 15.

    #2152

  12. bleege commented on Aug 26, 2015

    @bleege
    Contributor

    @mb12 Agreed. :-)

    I'm trying to nail down where things are coming of the rails. LOST has an API check around the code that is crashing on your phone. This is odd since in theory it shouldn't be executed on your device, but instead run something that is supported on your phone. In other words, I'm just trying to see how the API check plays:

    (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1)
  13. mb12 commented on Aug 27, 2015

    @mb12
    Author
  14. bleege commented on Aug 27, 2015

    @bleege
    Contributor

    @mb12 Thanks for clarifying that this is a LOST bug. Can you help me understand why the Build.VERSION checks as mentioned ^^ won't work? It doesn't have anything to do with specific versions of a class, so I'm just curious. Does the device that's having difficulties thinks it's API 17 even though it's not? (hence the code question ^^)

  15. bleege commented on Sep 4, 2015

    @bleege
    Contributor

    I'm going to close this for now as the LOST code appears to do the proper SDK Version checking based on the methods API availability. We also haven't been able to reproduce this internally.

    Can reopen later if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Androidcrash

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions