gpt4 book ai didi

java - Android Wear - Google Maps API v2 可用吗?

转载 作者:太空狗 更新时间:2023-10-29 14:11:04 25 4
gpt4 key购买 nike

我正在尝试在我的 Sony SmartWatch3 上显示 Google map (适用于 Android 的 Google Maps API V2)。

在我的 wear 布局中,我使用带有以下代码的 MapFragment:

<fragment
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/mapFragment"
class="com.google.android.gms.maps.MapFragment"/>

我的 wear 主 Activity 实现了 OnMapReadyCallback :

@Override
public void onMapReady(GoogleMap map) {
SupportMapFragment fragment = ( SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.mapFragment);
// Getting Google Map
GoogleMap googleMap = fragment.getMap();

当我在类路径中使用 Google Play Services for wearable 编译程序时,它无法编译。

当我在类路径中使用完整的 Google Play 服务编译程序时,它编译成功但是当我在智能 watch 上执行程序时,我得到这个异常:

02-03 16:44:23.456 2377-2377/com.example.andy.myfirstwearablemapapplication E/AndroidRuntime﹕ FATAL EXCEPTION: main
Process: com.example.andy.myfirstwearablemapapplication, PID: 2377
android.view.InflateException: Binary XML file line #7: Error inflating class fragment
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:763)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.wearable.view.WatchViewStub.inflate(WatchViewStub.java:179)
at android.support.wearable.view.WatchViewStub.onApplyWindowInsets(WatchViewStub.java:148)
at android.view.View.dispatchApplyWindowInsets(View.java:6514)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5782)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5786)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5786)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchApplyWindowInsets(PhoneWindow.java:2335)
at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1205)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1423)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
Caused by: java.lang.IllegalStateException: Unable to find dynamic class com.google.android.gms.maps.internal.CreatorImpl
at com.google.android.gms.maps.internal.x.a(Unknown Source)
at com.google.android.gms.maps.internal.x.U(Unknown Source)
at com.google.android.gms.maps.internal.x.S(Unknown Source)
at com.google.android.gms.maps.MapsInitializer.initialize(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.nO(Unknown Source)
at com.google.android.gms.maps.MapFragment$b.a(Unknown Source)
at com.google.android.gms.dynamic.a.a(Unknown Source)
at com.google.android.gms.dynamic.a.onInflate(Unknown Source)
at com.google.android.gms.maps.MapFragment.onInflate(Unknown Source)
at android.app.FragmentManagerImpl.onCreateView(FragmentManager.java:2115)
at android.app.Activity.onCreateView(Activity.java:5282)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:733)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:806)
at android.view.LayoutInflater.inflate(LayoutInflater.java:504)
at android.view.LayoutInflater.inflate(LayoutInflater.java:414)
at android.view.LayoutInflater.inflate(LayoutInflater.java:365)
at android.support.wearable.view.WatchViewStub.inflate(WatchViewStub.java:179)
at android.support.wearable.view.WatchViewStub.onApplyWindowInsets(WatchViewStub.java:148)
at android.view.View.dispatchApplyWindowInsets(View.java:6514)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5782)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5786)
at android.view.ViewGroup.dispatchApplyWindowInsets(ViewGroup.java:5786)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchApplyWindowInsets(PhoneWindow.java:2335)
at android.view.ViewRootImpl.dispatchApplyInsets(ViewRootImpl.java:1205)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1423)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1054)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5779)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5221)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)

是否真的可以在 Android Wear watch 上使用适用于 Android 的 Google Maps API V2 显示 map ?

如果是,你能告诉我怎么做吗? :)

如果不行,有没有其他解决方案来显示 map (如果可能,可拖动/可缩放的 map )?

提前致谢:)

最好的问候。

最佳答案

很遗憾,Android wear 目前无法显示谷歌地图。

在穿戴上制作 map 的工作正在进行中。--来自 googler

关于java - Android Wear - Google Maps API v2 可用吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28363874/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com