如何解决Android Studio中未显示地图方向的问题?

时间:2019-03-06 06:18:56

标签: java android android-maps

当我输入位置时 它没有显示(起点和终点)的路线:

Screenshot

这些是日志:

W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void libcore.io.Linux.connect(java.io.FileDescriptor, java.net.InetAddress, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void libcore.io.Linux.connect(java.io.FileDescriptor, java.net.InetAddress, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void libcore.io.Linux.connect(java.io.FileDescriptor, java.net.InetAddress, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void libcore.io.Linux.connect(java.io.FileDescriptor, java.net.InetAddress, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method java.net.InetAddress[] libcore.io.Linux.android_getaddrinfo(java.lang.String, android.system.StructAddrinfo, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
W/zygote64: Got a deoptimization request on un-deoptimizable method void java.lang.Thread.sleep(java.lang.Object, long, int)
I/zygote64: Do full code cache collection, code=0B, data=120KB
I/zygote64: After code cache collection, code=0B, data=0B

1 个答案:

答案 0 :(得分:0)

为使我们更好地为您提供帮助,您需要提供到目前为止您尝试过的内容或无效代码的详细信息。

通常,如果您需要打开一个地图,该地图显示从A点到B点的方向,这是一个有效的代码。

 Uri.Builder directionsBuilder = new Uri.Builder()
                .scheme("https")
                .authority("www.google.com")
                .appendPath("maps")
                .appendPath("dir")
                .appendPath("")
                .appendQueryParameter("api", "1")
                .appendQueryParameter("destination", latitude + "," + longitude);

        startActivity(new Intent(Intent.ACTION_VIEW, directionsBuilder.build()));