我正在开发用于Android的谷歌地图导航。 2.3 android版本。
我在谷歌上搜索了一些例子,但不确定是否显示所有错误。 .all显示相同的错误..这里我发布了最后一个我试过的
https://docs.google.com/uc?export=download&id=0B0MdROeR0jbvWVVNUV9jbk1OeEE
检查上面的代码并在2.3.3上测试......是否正常工作。
我的logcat信息是
05-21 13:46:53.219: E/AndroidRuntime(557): FATAL EXCEPTION: main
05-21 13:46:53.219: E/AndroidRuntime(557): java.lang.NoClassDefFoundError: com.google.android.gms.R$styleable
05-21 13:46:53.219: E/AndroidRuntime(557): at com.google.android.gms.maps.GoogleMapOptions.createFromAttributes(Unknown Source)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.google.android.gms.maps.SupportMapFragment.onInflate(Unknown Source)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.support.v4.app.FragmentActivity.onCreateView(FragmentActivity.java:279)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:563)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.Activity.setContentView(Activity.java:1657)
05-21 13:46:53.219: E/AndroidRuntime(557): at app.akexorcist.googlemapsv2direction.Main.onCreate(Main.java:27)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.os.Handler.dispatchMessage(Handler.java:99)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.os.Looper.loop(Looper.java:130)
05-21 13:46:53.219: E/AndroidRuntime(557): at android.app.ActivityThread.main(ActivityThread.java:3683)
05-21 13:46:53.219: E/AndroidRuntime(557): at java.lang.reflect.Method.invokeNative(Native Method)
05-21 13:46:53.219: E/AndroidRuntime(557): at java.lang.reflect.Method.invoke(Method.java:507)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
05-21 13:46:53.219: E/AndroidRuntime(557): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-21 13:46:53.219: E/AndroidRuntime(557): at dalvik.system.NativeStart.main(Native Method)
答案 0 :(得分:0)
也许您没有将Google Play服务项目添加到您的Eclipse工作区中,之后需要将依赖项添加到Google Play服务项目中GoogleMapsV2Direction 检查一下:
https://docs.google.com/document/pub?id=19nQzvKP-CVLd7_VrpwnHfl-AE9fjbJySowONZZtNHzw
对我来说这个项目有效
答案 1 :(得分:0)
看起来您没有导入google play services library
,因为它正在寻找styleable
资源
答案 2 :(得分:0)
您可能没有为其导入所需的库。
如果您需要有关如何将google-play-services导入项目的帮助,请检查this,
答案 3 :(得分:0)
确保您没有在Java Build Path中包含任何库作为项目。现在已经在Android标签中处理了这个问题。如果这不起作用,请尝试在Java Build Path中检查更多选项 - >订单和出口。