Error android.os.SystemClock.elapsedRealtimeNanos in MockLocationProvider.pushLocation -


i simulate gps position in app android , when

mymocklocationprovider.pushlocation(37.422, -122.084); 

i following error:

java.lang.nosuchmethoderror: android.os.systemclock.elapsedrealtimenanos @ mylab.mocklocationprovider.pushlocation(mocklocationprovider.java:36) 

any idea?

i having same problem , have realized using mobile api version of 16. when looked @ documentation of `systemclock.elapsedrealtimenanos()` method added after api version 17. so, guess using device api lower 17.

try following code , see if works:

location loc = new location(locationmanager.gps_provider); loc.setlatitude(37.422); loc.setlongitude(-122.084); loc.setaltitude(0); loc.settime(system.currenttimemillis()); loc.setaccuracy(10); if (android.os.build.version.sdk_int >= 17)     loc.setelapsedrealtimenanos(systemclock.elapsedrealtimenanos()); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -