我正在使用 Android 2.3.3 和 Google API 来开发地图应用程序。
问题出在下面的代码中:
GoogleHeaders headers = new GoogleHeaders();
headers.setApplicationName("My Sample Google App on Maps");
request.setHeaders(headers);
它拍摄时出现以下错误,
E/AndroidRuntime(382): FATAL EXCEPTION: main
E/AndroidRuntime(382): java.lang.IllegalAccessError: tried to access field com.google.api.client.googleapis.GoogleHeaders.userAgent from class com.google.api.client.googleapis.GoogleHeaders
E/AndroidRuntime(382): at com.google.api.client.googleapis.GoogleHeaders.setApplicationName(GoogleHeaders.java:129)
E/AndroidRuntime(382): at com.example.main.MapActivity$2.initialize(MapCallActivity.java:292)
E/AndroidRuntime(382): at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:91)
E/AndroidRuntime(382): at com.google.api.client.http.HttpRequestFactory.buildGetRequest(HttpRequestFactory.java:120)
E/AndroidRuntime(382): at com.example.main.MapActivity.MyMethod(MapCallActivity.java:248)
E/AndroidRuntime(382): at com.example.main.MapActivity.myMethod2(MapCallActivity.java:172)
E/AndroidRuntime(382): at com.example.main.MapActivity.onCreate(MapCallActivity.java:108)
E/AndroidRuntime(382): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime(382): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
E/AndroidRuntime(382): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
E/AndroidRuntime(382): at android.app.ActivityThread.access$1500(ActivityThread.java:117)
E/AndroidRuntime(382): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
E/AndroidRuntime(382): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime(382): at android.os.Looper.loop(Looper.java:130)
E/AndroidRuntime(382): at android.app.ActivityThread.main(ActivityThread.java:3683)
E/AndroidRuntime(382): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(382): at java.lang.reflect.Method.invoke(Method.java:507)
E/AndroidRuntime(382): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
E/AndroidRuntime(382): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
E/AndroidRuntime(382): at dalvik.system.NativeStart.main(Native Method)
请解释一下,因为我被困住了,无法超越这一点。
使用的 API:
google-api-client-googleapis-1.4.1-beta.jar
google-http-client-1.8.3-beta.jar
google-http-client-android2-1.8.3-beta.jar
google-oauth-client-1.8.0-beta.jar
帮助将不胜感激!