1

Gingerbread に Google Map API を使用しようとしています

これは私が得たものです

輸入:

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