1

我正在尝试将 Google Map APIs 用于 Gingerbread

这就是我得到的

进口:

import com.google.api.client.http.GenericUrl;
import com.google.api.client.http.HttpHeaders;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestFactory;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
//import com.google.api.client.http.json.JsonHttpParser;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.json.jackson.JacksonFactory;

函数调用

HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);

功能定义

public static HttpRequestFactory createRequestFactory(
        final HttpTransport httpTransport) {
    Log.d("Test Debug","Issue above");
    return httpTransport.createRequestFactory(new HttpRequestInitializer() {
        public void initialize(HttpRequest request) {
            HttpHeaders headers = new HttpHeaders();
            headers.setUserAgent("ZT-LocationSearch-Test");
            request.setHeaders(headers);
            JsonObjectParser parser = new JsonObjectParser(new JacksonFactory());
            request.setParser(parser);
        }
    });
}

问题是我的应用程序在此调用中意外关闭,LogCat 显示以下错误:

    07-28 11:03:34.679: W/dalvikvm(24879): VFY: unable to find class referenced in signature (Lcom/google/api/client/http/HttpTransport;)
07-28 11:03:34.699: W/dalvikvm(24879): Link of class 'Lcom/zt/location/GooglePlaces$1;' failed
07-28 11:03:34.709: E/dalvikvm(24879): Could not find class 'com.zt.location.GooglePlaces$1', referenced from method com.zt.location.GooglePlaces.createRequestFactory
07-28 11:03:34.719: W/dalvikvm(24879): VFY: unable to resolve new-instance 1209 (Lcom/zt/location/GooglePlaces$1;) in Lcom/zt/location/GooglePlaces;
07-28 11:03:34.719: E/dalvikvm(24879): Could not find class 'com.google.api.client.http.javanet.NetHttpTransport', referenced from method com.zt.location.GooglePlaces.getPlaceDetails
07-28 11:03:34.729: W/dalvikvm(24879): VFY: unable to resolve new-instance 1194 (Lcom/google/api/client/http/javanet/NetHttpTransport;) in Lcom/zt/location/GooglePlaces;
07-28 11:03:34.739: E/dalvikvm(24879): Could not find class 'com.google.api.client.http.javanet.NetHttpTransport', referenced from method com.zt.location.GooglePlaces.search
07-28 11:03:34.749: W/dalvikvm(24879): VFY: unable to resolve new-instance 1194 (Lcom/google/api/client/http/javanet/NetHttpTransport;) in Lcom/zt/location/GooglePlaces;
07-28 11:03:34.839: W/dalvikvm(24879): threadid=9: thread exiting with uncaught exception (group=0x40018578)

任何帮助/解决方法都会很棒。

谢谢!

编辑:

我正在尝试获取 Google Places 并解析 json 响应以显示。有什么办法可以打电话给

https://maps.googleapis.com/maps/api/place/search/json?
4

0 回答 0