Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix security exception (Nearby places not loading after permissions granted) #1440

Merged
merged 29 commits into from
Apr 18, 2018

Conversation

misaochan
Copy link
Member

@misaochan misaochan commented Apr 14, 2018

Work in progress

I have been attempting to fix #1413 and have partially succeeded. Now, after granting permissions, the Nearby points load. I think the issue with the previous attempts was that when permissions were granted, we did not check for the last known location and so refreshView() returned prematurely with the below code:

        if (curLatLang == null) {
            Timber.d("Skipping update of nearby places as location is unavailable");
            return;
        }

However, in this PR, the map is not created and a blank screen is shown, even though the points exist. If I tap on the list, the list displays fine, with the appropriate points. @neslihanturan do you think you could help with this?

Logs:

04-14 20:41:05.840: D/NearbyPlaces(23494): Reading from query result...
04-14 20:41:06.066: D/NearbyPlaces(23494): 44 results at radius: 1.000000
04-14 20:41:06.066: D/NearbyController(23494): Sorting places by distance...
04-14 20:41:06.126: D/NearbyActivity(23494): Init map fragment for the first time
04-14 20:41:06.171: W/OpenGLRenderer(23494): Points are too far apart 4.000000
04-14 20:41:06.178: I/art(23494): Rejecting re-init on previously-failed class java.lang.Class<com.mapbox.mapboxsdk.location.LocationSource>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapzen/android/lost/api/LostApiClient$ConnectionCallbacks;
04-14 20:41:06.178: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.178: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.178: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.178: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.178: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.178: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.178: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.178: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.178: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.178: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.178: I/art(23494): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapzen.android.lost.api.LostApiClient$ConnectionCallbacks" on path: DexPathList[[zip file "/data/app/fr.free.nrw.commons.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons.debug-1/lib/arm64, /data/app/fr.free.nrw.commons.debug-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
04-14 20:41:06.178: I/art(23494):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
04-14 20:41:06.178: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
04-14 20:41:06.178: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-14 20:41:06.178: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.178: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.178: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.178: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.178: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.178: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.178: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.178: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.178: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.178: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.178: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.179: I/art(23494): Rejecting re-init on previously-failed class java.lang.Class<com.mapbox.mapboxsdk.EmptyLocationSource>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapbox/mapboxsdk/location/LocationSource;
04-14 20:41:06.179: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.179: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.179: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.179: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.179: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.179: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.179: I/art(23494): Caused by: java.lang.ClassNotFoundException: com.mapbox.mapboxsdk.location.LocationSource
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.VMClassLoader.findLoadedClass!(java.lang.ClassLoader, java.lang.String) (VMClassLoader.java:-2)
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.ClassLoader.findLoadedClass(java.lang.String) (ClassLoader.java:742)
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:362)
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-14 20:41:06.179: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.179: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.179: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.179: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.179: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.179: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.179: I/art(23494): Rejecting re-init on previously-failed class java.lang.Class<com.mapbox.mapboxsdk.location.LocationSource>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapzen/android/lost/api/LostApiClient$ConnectionCallbacks;
04-14 20:41:06.179: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.179: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.179: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.179: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.179: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.179: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.179: I/art(23494): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapzen.android.lost.api.LostApiClient$ConnectionCallbacks" on path: DexPathList[[zip file "/data/app/fr.free.nrw.commons.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons.debug-1/lib/arm64, /data/app/fr.free.nrw.commons.debug-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
04-14 20:41:06.179: I/art(23494):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
04-14 20:41:06.179: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-14 20:41:06.179: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.179: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.179: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.179: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.179: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.179: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.179: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.179: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.179: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.180: I/art(23494): Rejecting re-init on previously-failed class java.lang.Class<com.mapbox.mapboxsdk.location.LocationSource>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/mapzen/android/lost/api/LostApiClient$ConnectionCallbacks;
04-14 20:41:06.180: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.180: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.180: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.180: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.180: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.180: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.180: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.180: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.180: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.180: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.180: I/art(23494): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.mapzen.android.lost.api.LostApiClient$ConnectionCallbacks" on path: DexPathList[[zip file "/data/app/fr.free.nrw.commons.debug-1/base.apk"],nativeLibraryDirectories=[/data/app/fr.free.nrw.commons.debug-1/lib/arm64, /data/app/fr.free.nrw.commons.debug-1/base.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64]]
04-14 20:41:06.180: I/art(23494):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
04-14 20:41:06.180: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
04-14 20:41:06.180: I/art(23494):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
04-14 20:41:06.180: I/art(23494):   at com.mapbox.mapboxsdk.Mapbox com.mapbox.mapboxsdk.Mapbox.getInstance(android.content.Context, java.lang.String) (Mapbox.java:52)
04-14 20:41:06.180: I/art(23494):   at void fr.free.nrw.commons.nearby.NearbyMapFragment.onCreate(android.os.Bundle) (NearbyMapFragment.java:153)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.Fragment.performCreate(android.os.Bundle) (Fragment.java:2329)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.moveToState(android.support.v4.app.Fragment, int, int, int, boolean) (FragmentManager.java:1377)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.addToFirstInLastOut(android.support.v4.app.BackStackRecord, android.support.v4.app.BackStackRecord$Op, android.util.SparseArray, boolean, boolean) (FragmentTransition.java:1109)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.calculateFragments(android.support.v4.app.BackStackRecord, android.util.SparseArray, boolean) (FragmentTransition.java:996)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentTransition.startTransitions(android.support.v4.app.FragmentManagerImpl, java.util.ArrayList, java.util.ArrayList, int, int, boolean) (FragmentTransition.java:99)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.executeOpsTogether(java.util.ArrayList, java.util.ArrayList, int, int) (FragmentManager.java:2364)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl.removeRedundantOperationsAndExecute(java.util.ArrayList, java.util.ArrayList) (FragmentManager.java:2322)
04-14 20:41:06.180: I/art(23494):   at boolean android.support.v4.app.FragmentManagerImpl.execPendingActions() (FragmentManager.java:2229)
04-14 20:41:06.180: I/art(23494):   at void android.support.v4.app.FragmentManagerImpl$1.run() (FragmentManager.java:700)
04-14 20:41:06.180: I/art(23494):   at void android.os.Handler.handleCallback(android.os.Message) (Handler.java:751)
04-14 20:41:06.180: I/art(23494):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:95)
04-14 20:41:06.180: I/art(23494):   at void android.os.Looper.loop() (Looper.java:154)
04-14 20:41:06.180: I/art(23494):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6692)
04-14 20:41:06.180: I/art(23494):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
04-14 20:41:06.180: I/art(23494):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:1468)
04-14 20:41:06.180: I/art(23494):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:1358)
04-14 20:41:06.182: D/AndroidLocationEngine(23494): Priority set to 0 (current provider is passive).
04-14 20:41:06.206: D/MapboxTelemetry(23494): Shutting down telemetry service.
04-14 20:41:06.211: I/art(23494): Thread[1,tid=23494,Native,Thread*=0x7cc62c7a00,peer=0x777b4068,"main"] recursive attempt to load library "/data/app/fr.free.nrw.commons.debug-1/lib/arm64/libmapbox-gl.so"
04-14 20:41:06.215: I/art(23494): Thread[1,tid=23494,Native,Thread*=0x7cc62c7a00,peer=0x777b4068,"main"] recursive attempt to load library "/data/app/fr.free.nrw.commons.debug-1/lib/arm64/libmapbox-gl.so"
04-14 20:41:06.215: I/art(23494): Thread[1,tid=23494,Native,Thread*=0x7cc62c7a00,peer=0x777b4068,"main"] recursive attempt to load library "/data/app/fr.free.nrw.commons.debug-1/lib/arm64/libmapbox-gl.so"
04-14 20:41:06.219: D/NearbyListFragment(23494): NearbyListFragment created

@codecov-io
Copy link

codecov-io commented Apr 14, 2018

Codecov Report

Merging #1440 into 2.7.x-release will decrease coverage by 0.01%.
The diff coverage is 0%.

Impacted file tree graph

@@               Coverage Diff                @@
##           2.7.x-release   #1440      +/-   ##
================================================
- Coverage            3.3%   3.28%   -0.02%     
================================================
  Files                128     128              
  Lines               6847    6870      +23     
  Branches             668     673       +5     
================================================
  Hits                 226     226              
- Misses              6606    6629      +23     
  Partials              15      15
Impacted Files Coverage Δ
...ava/fr/free/nrw/commons/nearby/NearbyActivity.java 0% <0%> (ø) ⬆️
.../fr/free/nrw/commons/nearby/NearbyMapFragment.java 0% <0%> (ø) ⬆️
...e/nrw/commons/location/LocationServiceManager.java 0% <0%> (ø) ⬆️
...fr/free/nrw/commons/nearby/NearbyListFragment.java 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a3b6fc...b200a29. Read the comment docs.

@misaochan
Copy link
Member Author

misaochan commented Apr 14, 2018

The current code seems to fix the map problem, tested on API 24 real device.

The problem is, I don't think it's a good solution, it's just a hack I made to figure out what the problem was. For some reason curLatLang was defaulting to null when the bundle had strings put into it in populatePlaces(), so the string being sent to NearbyMapFragment was of course null. By putting the curLatLang into the bundle straight away prior to calling this::populatePlaces, we "prevent" that problem.

Ideally we should find out why it is null though.

The hack:

            String gsonCurLatLng = gson.toJson(curLatLang);
            bundle.putString("CurLatLng", gsonCurLatLng);

            placesDisposable = Observable.fromCallable(() -> nearbyController
                    .loadAttractionsFromLocation(curLatLang))
                    .subscribeOn(Schedulers.io())
                    .observeOn(AndroidSchedulers.mainThread())
                    .subscribe(this::populatePlaces);
        }

Please don't merge yet, even if we do decide to go with this, I need to tidy up the code. :)

@neslihanturan
Copy link
Collaborator

@misaochan it would be great if you can share a screenshot to display what blank map means. If it only happens on emulator, some of my emulator devices have this problem too. But I am sure it is related with the emulator.

@misaochan
Copy link
Member Author

misaochan commented Apr 15, 2018

The issue happened on my real device. :) But it should now be fixed by the hack - as I mentioned, it was caused by curLatLang defaulting to null in the bundle that was passed to NearbyMapFragment. I can go back to an earlier commit and take a SS there if needed, however it was literally a screen with "Nearby Places" on the top and nothing else.

@neslihanturan
Copy link
Collaborator

neslihanturan commented Apr 16, 2018

According to what I read and since I know the related code base, I can say that thing we are doing can be a little risky. But will investigate further to be sure.

Update after testing: It worked on my both tests by the way.

@misaochan
Copy link
Member Author

Thanks @neslihanturan . Could you please try and see if this fixes #1438 for you as well? If it does , then we can kill two birds with one stone here.

Since this works for both of us, I'll tidy up my code and leave a TODO for finding a better fix.

@neslihanturan
Copy link
Collaborator

I am still able to reproduce the bug on this branch too:/

Maybe you are missing a step
1- first open list
2- go to a directory (I mean change activity)
3- come back with back button
4- use map marker and its direction button

@misaochan
Copy link
Member Author

How odd. It happens to me sometimes but not at other times. When it happens, I can never access Directions from the map at ALL (although I can from the list). The steps don't matter - it happens regardless of whether I have opened the list beforehand, or changed activity, or not.

When it doesn't happen, I can always access Directions from the map, and again the steps don't matter.

Okay, so this PR clearly isn't a fix for that problem. I guess we can kill just one bird with this stone and then look for the other bird. ;)

@neslihanturan
Copy link
Collaborator

I think this PR is ready to merge?

@misaochan
Copy link
Member Author

@neslihanturan I just need to do a bit more tidying and testing. Will ping you when it is, thanks. :)

@misaochan misaochan changed the title [WIP] Fix security exception (Nearby places not loading after permissions granted) Fix security exception (Nearby places not loading after permissions granted) Apr 18, 2018
@misaochan
Copy link
Member Author

@neslihanturan Okay, this should be ready once Travis is done. :)

@neslihanturan neslihanturan merged commit 3b129a6 into commons-app:2.7.x-release Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants