Issue
I am new to programming in Android and have been working through this tutorial for implementing Google Places in an app. When I try to use Google places to retrieve nearby places, my app crashes.
I believe the problem is here when I try to create a http request factory:
/**
* Creating http request Factory
* */
public static HttpRequestFactory createRequestFactory(final HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
HttpHeaders headers = new HttpHeaders();
headers.setUserAgent("Searching Places..");
request.setHeaders(headers);
JsonObjectParser parser = new JsonObjectParser(new JacksonFactory());
request.setParser(parser);
}
});
}
Here are the resources from StackOverflow I used to create this method using google-api-java-client-1.15.0-rc:
RequestFactory , Jackson Factory
Here is the class that the above method is contained in:
import android.util.Log;
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.HttpResponseException;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonObjectParser;
import com.google.api.client.json.jackson2.JacksonFactory;
public class GooglePlaces {
/** Global instance of the HTTP transport. */
private static final HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
// Google API Key
private static final String API_KEY = "(HIDDEN ON PURPOSE)";
// Google Places search url's
private static final String PLACES_SEARCH_URL = "https://maps.googleapis.com/maps/api/place/search/json?";
private static final String PLACES_TEXT_SEARCH_URL = "https://maps.googleapis.com/maps/api/place/search/json?";
private static final String PLACES_DETAILS_URL = "https://maps.googleapis.com/maps/api/place/details/json?";
private double _latitude;
private double _longitude;
private double _radius;
/**
* Searching places
*
* @param latitude - latitude of place
* @params longitude - longitude of place
* @param radius - radius of searchable area
* @param types - type of place to search
* @return list of places
* */
public PlacesList search(double latitude, double longitude, double radius,
String types) throws Exception {
this._latitude = latitude;
this._longitude = longitude;
this._radius = radius;
try {
HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
HttpRequest request = httpRequestFactory
.buildGetRequest(new GenericUrl(PLACES_SEARCH_URL));
request.getUrl().put("key", API_KEY);
request.getUrl().put("location", _latitude + "," + _longitude);
request.getUrl().put("radius", _radius); // in meters
request.getUrl().put("sensor", "false");
if (types != null)
request.getUrl().put("types", types);
PlacesList list = request.execute().parseAs(PlacesList.class);
// Check log cat for places response status
Log.d("Places Status", "" + list.status);
return list;
} catch (HttpResponseException e) {
Log.e("Error:", e.getMessage());
return null;
}
}
/**
* Searching single place full details
*
* @param refrence
* - reference id of place - which you will get in search api
* request
* */
public PlaceDetails getPlaceDetails(String reference) throws Exception {
try {
HttpRequestFactory httpRequestFactory = createRequestFactory(HTTP_TRANSPORT);
HttpRequest request = httpRequestFactory
.buildGetRequest(new GenericUrl(PLACES_DETAILS_URL));
request.getUrl().put("key", API_KEY);
request.getUrl().put("reference", reference);
request.getUrl().put("sensor", "false");
PlaceDetails place = request.execute().parseAs(PlaceDetails.class);
return place;
} catch (HttpResponseException e) {
Log.e("Error in Perform Details", e.getMessage());
throw e;
}
}
/**
* Creating http request Factory
* */
public static HttpRequestFactory createRequestFactory(final HttpTransport transport) {
return transport.createRequestFactory(new HttpRequestInitializer() {
public void initialize(HttpRequest request) {
HttpHeaders headers = new HttpHeaders();
headers.setUserAgent("Searching Places..");
request.setHeaders(headers);
JsonObjectParser parser = new JsonObjectParser(new JacksonFactory());
request.setParser(parser);
}
});
}
}
Here is the class where I am getting the "FATAL EXCEPTION: AsyncTask#1" error:
import java.util.ArrayList;
import java.util.HashMap;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.AsyncTask;
import android.os.Bundle;
import android.text.Html;
import android.util.Log;
import android.view.Menu;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.Button;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
public class CheckAreaActivity extends Activity {
// flag for Internet connection status
Boolean isInternetPresent = false;
// Connection detector class
ConnectionDetector connectionDetector;
// Alert Dialog Manager
AlertDialogManager alert = new AlertDialogManager();
// Google Places
GooglePlaces googlePlaces;
// Places List
PlacesList nearPlaces;
// GPS Location
GPSTracker gps;
// Button
Button btnShowOnMap;
// Progress dialog
ProgressDialog progressDialog;
// Places Listview
ListView placesListView;
// ListItems data
ArrayList<HashMap<String, String>> placesListItems = new ArrayList<HashMap<String, String>>();
// KEY Strings
public static String KEY_REFERENCE = "reference"; // id of the place
public static String KEY_NAME = "name"; // name of the place
public static String KEY_VICINITY = "vicinity"; // Place area name
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.check_area_layout);
this.getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,
R.layout.window_title);
this.connectionDetector = new ConnectionDetector(
this.getApplicationContext());
// Check if Internet availability
this.isInternetPresent = this.connectionDetector
.isConnectingToInternet();
if (!this.isInternetPresent) {
// No Internet connection
this.alert.showAlertDialog(CheckAreaActivity.this,
"Internet Connection Error",
"Please connect to working Internet connection", false);
// Stop executing code
return;
}
// Create GPS Class object
this.gps = new GPSTracker(this);
// Check if GPS location can get location
if (this.gps.canGetLocation()) {
Log.d("Your Location", "latitude: " + this.gps.getLatitude()
+ ", longitude: " + this.gps.getLongitude());
} else {
// Can not get user's current location
this.alert.showAlertDialog(CheckAreaActivity.this, "GPS Status",
"Couldn't get location informaiton. Please enable GPS",
false);
// stop executing code
return;
}
// Get listview
this.placesListView = (ListView) findViewById(R.id.list);
// Button show on map
this.btnShowOnMap = (Button) findViewById(R.id.btn_show_map);
// Call background Async task to load Google Places
// After getting places from Google all the data is hown in listview
new LoadPlaces().execute();
/**
* Button click event for show on map
*/
this.btnShowOnMap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getApplicationContext(),
PlacesMapActivity.class);
// Sending user current geo location
intent.putExtra("user_latitude",
Double.toString(gps.getLatitude()));
intent.putExtra("user_longitude",
Double.toString(gps.getLongitude()));
// passing near places to map activity
intent.putExtra("near_places", nearPlaces);
// starting activity
startActivity(intent);
}
});
/**
* ListItem click event On selecting a list item SinglePlaceActivity is
* launched
*/
this.placesListView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int positon, long id) {
// getting values from selected listItem
String reference = ((TextView) view
.findViewById(R.id.reference)).getText().toString();
// Starting new intent
Intent intent = new Intent(getApplicationContext(),
SinglePlaceActivity.class);
// Sending place reference id to single place activity
// place reference id used to get "Place full details"
intent.putExtra(KEY_REFERENCE, reference);
startActivity(intent);
}
});
}
/**
* Background Async Task to Load Google places
*/
class LoadPlaces extends AsyncTask<Void, Void, PlacesList> {
/**
* Before starting background thread Show Progress Dialog
* */
protected void onPreExecute() {
super.onPreExecute();
progressDialog = new ProgressDialog(CheckAreaActivity.this);
progressDialog.setMessage(Html
.fromHtml("<b>Search</b><br/>Loading Places..."));
progressDialog.setIndeterminate(false);
progressDialog.setCancelable(false);
progressDialog.show();
progressDialog.show();
}
@Override
protected PlacesList doInBackground(Void... params) {
// creating Places class object
googlePlaces = new GooglePlaces();
try {
// Separeate your place types by PIPE symbol "|"
// If you want all types places make it as null
// Check list of types supported by google
//
String types = "cafe|restaurant";
// Radius in meters
double radius = 1609.34; // 1609.34 meters = 1 mile
// get nearest places
nearPlaces = googlePlaces.search(gps.getLatitude(),
gps.getLongitude(), radius, types);
} catch (Exception e) {
e.printStackTrace();
}
return nearPlaces;
}
/**
* After completing background task Dismiss the progress dialog and show
* the data in UI Always use runOnUiThread(new Runnable()) to update UI
* from background thread, otherwise will get error
* **/
@Override
protected void onPostExecute(PlacesList nearPlaces1) {
super.onPostExecute(nearPlaces1);
nearPlaces = nearPlaces1;
// dismiss the dialog after getting all products
progressDialog.dismiss();
// updating UI from Background Thread
// updating UI from Background Thread
runOnUiThread(new Runnable() {
public void run() {
/**
* Updating parsed Places into LISTVIEW
* */
// Get json response status
String status = nearPlaces.status;
// Check for all possible status
if (status.equals("OK")) {
// Successfully got places details
if (nearPlaces.results != null) {
// loop through each place
for (Place place : nearPlaces.results) {
HashMap<String, String> map = new HashMap<String, String>();
// Place reference won't display in listview
// - it
// will be hidden
// Place reference is used to get
// "place full details"
map.put(KEY_REFERENCE, place.reference);
// Place name
map.put(KEY_NAME, place.name);
// adding HashMap to ArrayList
placesListItems.add(map);
}
// list adapter
ListAdapter adapter = new SimpleAdapter(
CheckAreaActivity.this, placesListItems,
R.layout.list_item, new String[] {
KEY_REFERENCE, KEY_NAME },
new int[] { R.id.reference, R.id.name });
// Adding data into listview
placesListView.setAdapter(adapter);
}
} else if (status.equals("ZERO_RESULTS")) {
// Zero results found
alert.showAlertDialog(
CheckAreaActivity.this,
"Near Places",
"Sorry no places found. Try to change the types of places",
false);
} else if (status.equals("UNKNOWN_ERROR")) {
alert.showAlertDialog(CheckAreaActivity.this,
"Places Error", "Sorry unknown error occured.",
false);
} else if (status.equals("OVER_QUERY_LIMIT")) {
alert.showAlertDialog(
CheckAreaActivity.this,
"Places Error",
"Sorry query limit to google places is reached",
false);
} else if (status.equals("REQUEST_DENIED")) {
alert.showAlertDialog(CheckAreaActivity.this,
"Places Error",
"Sorry error occured. Request is denied", false);
} else if (status.equals("INVALID_REQUEST")) {
alert.showAlertDialog(CheckAreaActivity.this,
"Places Error",
"Sorry error occured. Invalid Request", false);
} else {
alert.showAlertDialog(CheckAreaActivity.this,
"Places Error", "Sorry error occured.", false);
}
}
});
}
}
@Override
public boolean onCreateOptionsMenu(Menu menu){
getMenuInflater().inflate(R.menu.check_area_menu, menu);
return true;
}
}
I used this resource from StackOverflow in writing the AsyncTask.
Here is my AndroidManifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.renterview"
android:versionCode="1"
android:versionName="1.0" >
<!-- Internet Permissions -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- Network State Permissions -->
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<!-- GPS access Permissions -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
<application
android:allowBackup="true"
android:icon="@drawable/icon"
android:label="@string/app_name"
android:theme="@style/CustomTheme" >
<!-- Add Google Map Library -->
<uses-library android:name="com.google.android.maps" />
<!-- Splash Screen Activity -->
<activity
android:name="com.example.renterview.Splash"
android:label="@string/app_name"
android:theme="@android:style/Theme.NoTitleBar" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Main Activity -->
<activity
android:name="com.example.renterview.Main"
android:label="@string/app_name" >
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<!-- Check Area Activity -->
<activity android:name="com.example.renterview.CheckAreaActivity" />
<!-- Single Places Activity -->
<activity android:name="com.example.renterview.SinglePlaceActivity" />
<!-- PlacesMapActivty -->
<activity android:name="com.example.renterview.PlacesMapActivity" />
</application>
Here is what LogCat is showing me:
08-03 17:06:12.490: D/dalvikvm(895): GC_FOR_ALLOC freed 49K, 7% free 2421K/2596K, paused 36ms, total 48ms
08-03 17:06:12.529: I/dalvikvm-heap(895): Grow heap (frag case) to 6.901MB for 4633616-byte allocation
08-03 17:06:12.590: D/dalvikvm(895): GC_FOR_ALLOC freed <1K, 3% free 6945K/7124K, paused 59ms, total 59ms
08-03 17:06:12.659: D/dalvikvm(895): GC_CONCURRENT freed <1K, 3% free 6945K/7124K, paused 9ms+5ms, total 70ms
08-03 17:06:13.611: D/libEGL(895): loaded /system/lib/egl/libEGL_emulation.so
08-03 17:06:13.629: D/(895): HostConnection::get() New Host Connection established 0x2a157c58, tid 895
08-03 17:06:13.650: D/libEGL(895): loaded /system/lib/egl/libGLESv1_CM_emulation.so
08-03 17:06:13.660: D/libEGL(895): loaded /system/lib/egl/libGLESv2_emulation.so
08-03 17:06:13.740: W/EGL_emulation(895): eglSurfaceAttrib not implemented
08-03 17:06:13.760: D/OpenGLRenderer(895): Enabling debug mode 0
08-03 17:06:17.260: W/EGL_emulation(895): eglSurfaceAttrib not implemented
08-03 17:09:05.439: D/GPS(895): GPS Enabled
08-03 17:09:05.439: D/Your Location(895): latitude: -85.07573166666667, longitude: 33.580275
08-03 17:09:05.519: D/dalvikvm(895): GC_CONCURRENT freed 33K, 2% free 8343K/8488K, paused 70ms+49ms, total 217ms
08-03 17:09:06.152: W/EGL_emulation(895): eglSurfaceAttrib not implemented
08-03 17:09:06.282: W/EGL_emulation(895): eglSurfaceAttrib not implemented
08-03 17:09:07.229: E/dalvikvm(895): Could not find class 'com.fasterxml.jackson.core.JsonFactory', referenced from method com.google.api.client.json.jackson2.JacksonFactory.<init>
08-03 17:09:07.229: W/dalvikvm(895): VFY: unable to resolve new-instance 523 (Lcom/fasterxml/jackson/core/JsonFactory;) in Lcom/google/api/client/json/jackson2/JacksonFactory;
08-03 17:09:07.239: D/dalvikvm(895): VFY: replacing opcode 0x22 at 0x0003
08-03 17:09:07.249: W/dalvikvm(895): VFY: unable to find class referenced in signature (Lcom/fasterxml/jackson/core/JsonToken;)
08-03 17:09:07.249: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonToken.ordinal, referenced from method com.google.api.client.json.jackson2.JacksonFactory.convert
08-03 17:09:07.249: W/dalvikvm(895): VFY: unable to resolve virtual method 3644: Lcom/fasterxml/jackson/core/JsonToken;.ordinal ()I
08-03 17:09:07.249: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0006
08-03 17:09:07.259: W/dalvikvm(895): VFY: unable to resolve static field 998 (UTF8) in Lcom/fasterxml/jackson/core/JsonEncoding;
08-03 17:09:07.259: D/dalvikvm(895): VFY: replacing opcode 0x62 at 0x0004
08-03 17:09:07.259: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonFactory.createJsonGenerator, referenced from method com.google.api.client.json.jackson2.JacksonFactory.createJsonGenerator
08-03 17:09:07.259: W/dalvikvm(895): VFY: unable to resolve virtual method 3608: Lcom/fasterxml/jackson/core/JsonFactory;.createJsonGenerator (Ljava/io/Writer;)Lcom/fasterxml/jackson/core/JsonGenerator;
08-03 17:09:07.259: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0004
08-03 17:09:07.269: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonFactory.createJsonParser, referenced from method com.google.api.client.json.jackson2.JacksonFactory.createJsonParser
08-03 17:09:07.269: W/dalvikvm(895): VFY: unable to resolve virtual method 3609: Lcom/fasterxml/jackson/core/JsonFactory;.createJsonParser (Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;
08-03 17:09:07.269: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0007
08-03 17:09:07.269: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonFactory.createJsonParser, referenced from method com.google.api.client.json.jackson2.JacksonFactory.createJsonParser
08-03 17:09:07.269: W/dalvikvm(895): VFY: unable to resolve virtual method 3609: Lcom/fasterxml/jackson/core/JsonFactory;.createJsonParser (Ljava/io/InputStream;)Lcom/fasterxml/jackson/core/JsonParser;
08-03 17:09:07.269: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0007
08-03 17:09:07.281: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonFactory.createJsonParser, referenced from method com.google.api.client.json.jackson2.JacksonFactory.createJsonParser
08-03 17:09:07.281: W/dalvikvm(895): VFY: unable to resolve virtual method 3610: Lcom/fasterxml/jackson/core/JsonFactory;.createJsonParser (Ljava/io/Reader;)Lcom/fasterxml/jackson/core/JsonParser;
08-03 17:09:07.281: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0007
08-03 17:09:07.281: I/dalvikvm(895): Could not find method com.fasterxml.jackson.core.JsonFactory.createJsonParser, referenced from method com.google.api.client.json.jackson2.JacksonFactory.createJsonParser
08-03 17:09:07.281: W/dalvikvm(895): VFY: unable to resolve virtual method 3611: Lcom/fasterxml/jackson/core/JsonFactory;.createJsonParser (Ljava/lang/String;)Lcom/fasterxml/jackson/core/JsonParser;
08-03 17:09:07.289: D/dalvikvm(895): VFY: replacing opcode 0x6e at 0x0007
08-03 17:09:07.299: D/dalvikvm(895): DexOpt: unable to opt direct call 0x0e15 at 0x05 in Lcom/google/api/client/json/jackson2/JacksonFactory;.<init>
08-03 17:09:07.299: W/dalvikvm(895): threadid=11: thread exiting with uncaught exception (group=0x40a71930)
08-03 17:09:07.349: E/AndroidRuntime(895): FATAL EXCEPTION: AsyncTask #1
08-03 17:09:07.349: E/AndroidRuntime(895): java.lang.RuntimeException: An error occured while executing doInBackground()
08-03 17:09:07.349: E/AndroidRuntime(895): at android.os.AsyncTask$3.done(AsyncTask.java:299)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
08-03 17:09:07.349: E/AndroidRuntime(895): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.lang.Thread.run(Thread.java:856)
08-03 17:09:07.349: E/AndroidRuntime(895): Caused by: java.lang.NoClassDefFoundError: com.fasterxml.jackson.core.JsonFactory
08-03 17:09:07.349: E/AndroidRuntime(895): at com.google.api.client.json.jackson2.JacksonFactory.<init>(JacksonFactory.java:44)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.example.renterview.GooglePlaces$1.initialize(GooglePlaces.java:109)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.google.api.client.http.HttpRequestFactory.buildRequest(HttpRequestFactory.java:93)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.google.api.client.http.HttpRequestFactory.buildGetRequest(HttpRequestFactory.java:122)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.example.renterview.GooglePlaces.search(GooglePlaces.java:53)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.example.renterview.CheckAreaActivity$LoadPlaces.doInBackground(CheckAreaActivity.java:195)
08-03 17:09:07.349: E/AndroidRuntime(895): at com.example.renterview.CheckAreaActivity$LoadPlaces.doInBackground(CheckAreaActivity.java:1)
08-03 17:09:07.349: E/AndroidRuntime(895): at android.os.AsyncTask$2.call(AsyncTask.java:287)
08-03 17:09:07.349: E/AndroidRuntime(895): at java.util.concurrent.FutureTask.run(FutureTask.java:234)
08-03 17:09:07.349: E/AndroidRuntime(895): ... 4 more
08-03 17:09:08.159: W/EGL_emulation(895): eglSurfaceAttrib not implemented
08-03 17:09:08.929: E/WindowManager(895): Activity com.example.renterview.CheckAreaActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{412a33c0 V.E..... R....... 0,0-322,175} that was originally added here
08-03 17:09:08.929: E/WindowManager(895): android.view.WindowLeaked: Activity com.example.renterview.CheckAreaActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{412a33c0 V.E..... R....... 0,0-322,175} that was originally added here
08-03 17:09:08.929: E/WindowManager(895): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:354)
08-03 17:09:08.929: E/WindowManager(895): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:216)
08-03 17:09:08.929: E/WindowManager(895): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
08-03 17:09:08.929: E/WindowManager(895): at android.app.Dialog.show(Dialog.java:281)
08-03 17:09:08.929: E/WindowManager(895): at com.example.renterview.CheckAreaActivity$LoadPlaces.onPreExecute(CheckAreaActivity.java:175)
08-03 17:09:08.929: E/WindowManager(895): at android.os.AsyncTask.executeOnExecutor(AsyncTask.java:586)
08-03 17:09:08.929: E/WindowManager(895): at android.os.AsyncTask.execute(AsyncTask.java:534)
08-03 17:09:08.929: E/WindowManager(895): at com.example.renterview.CheckAreaActivity.onCreate(CheckAreaActivity.java:109)
08-03 17:09:08.929: E/WindowManager(895): at android.app.Activity.performCreate(Activity.java:5104)
08-03 17:09:08.929: E/WindowManager(895): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
08-03 17:09:08.929: E/WindowManager(895): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2144)
08-03 17:09:08.929: E/WindowManager(895): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2230)
08-03 17:09:08.929: E/WindowManager(895): at android.app.ActivityThread.access$600(ActivityThread.java:141)
08-03 17:09:08.929: E/WindowManager(895): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1234)
08-03 17:09:08.929: E/WindowManager(895): at android.os.Handler.dispatchMessage(Handler.java:99)
08-03 17:09:08.929: E/WindowManager(895): at android.os.Looper.loop(Looper.java:137)
08-03 17:09:08.929: E/WindowManager(895): at android.app.ActivityThread.main(ActivityThread.java:5041)
08-03 17:09:08.929: E/WindowManager(895): at java.lang.reflect.Method.invokeNative(Native Method)
08-03 17:09:08.929: E/WindowManager(895): at java.lang.reflect.Method.invoke(Method.java:511)
08-03 17:09:08.929: E/WindowManager(895): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
08-03 17:09:08.929: E/WindowManager(895): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
08-03 17:09:08.929: E/WindowManager(895): at dalvik.system.NativeStart.main(Native Method)
I believe that the JsonFactory error might be the cause of all the other erros that are popping up on LogCat?
Here are the .jar files I have in my libs folder:
android-support-v4.jar
google-api-client-1.15.0-rc.jar
google-api-client-android-1.15.0-rc.jar
google-http-client-1.15.0-rc.jar
google-http-client-android-1.15.0-rc.jar
google-http-client-jackson2-1.15.0-rc.jar
google-oauth-client-1.15.0-rc.jar
gson-2.1.jar
guava-11.0.2.jar
jackson-core-asl-1.9.11.jar
jsr305-1.3.9.jar
protobuf-java-2.4.1.jar
Project Build Target I have (API Level 17)(Google APIs is checkmarked):
Google APIs[Android 4.2.2]
Android Dependencies
My inexperience in android development has left me stuck for the moment. Any and all help would be greatly appreaciated! Thanks in advance
Solution
Your .jar is for jackson-core version 1.9 but the Google API you're using depends on Jackson 2. The package structure com.fasterxml.* doesn't exist in the 1.9 .jar, it's all .org.codehaus.*
You can get the 2.x .jar at http://wiki.fasterxml.com/JacksonDownload if you look under "Downloads, 2.x".
Hope this helps.
Answered By - Prmths
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.