Fixed
Status Update
Comments
yb...@google.com <yb...@google.com> #2
note that this code does work using Google API version 7 for android 2.1
wo...@gmail.com <wo...@gmail.com> #3
I am also having the same issue with an AVD created for Google API v8.
List<Address> addresses = geocoder.getFromLocationName("Clock Tower, Anantapur, Andhra Pradesh, India", 1);
The full stacktrace is as below:
java.io.IOException: Service not Available
at android.location.Geocoder.getFromLocationName(Geocoder.java:159)
at org.prashlabs.android.taskmanager.AddLocationMapActivity.mapCurrentAddress(AddLocationMapActivity.java
at org.prashlabs.android.taskmanager.AddLocationMapActivity$2.onClick(AddLocationMapActivity.java:60)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
List<Address> addresses = geocoder.getFromLocationName("Clock Tower, Anantapur, Andhra Pradesh, India", 1);
The full stacktrace is as below:
java.io.IOException: Service not Available
at android.location.Geocoder.getFromLocationName(Geocoder.java:159)
at org.prashlabs.android.taskmanager.AddLocationMapActivity.mapCurrentAddress(AddLocationMapActivity.java
at org.prashlabs.android.taskmanager.AddLocationMapActivity$2.onClick(AddLocationMapActivity.java:60)
at android.view.View.performClick(View.java:2408)
at android.view.View$PerformClick.run(View.java:8816)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
wo...@gmail.com <wo...@gmail.com> #4
It will work on the actual 2.2 device. That's the only information I know (not affiliated with Google). I'm actually going to look into the SAME bug this evening. Seems like a giant thing to overlook.
mm...@commonsware.com <mm...@commonsware.com> #5
Still not fixed? I have the same issue when using the Geocoder...
wo...@gmail.com <wo...@gmail.com> #6
I'm getting the same error here
yb...@google.com <yb...@google.com> #7
Just installed CyanogenMod 6 alfa and now GeoCoder works fine. I guess it will work on final builds of stock Froyo too.
wo...@gmail.com <wo...@gmail.com> #8
[Comment deleted]
yb...@google.com <yb...@google.com> #10
I also meet the same error
wo...@gmail.com <wo...@gmail.com> #11
yb...@google.com <yb...@google.com> #12
Are you guys using this code on the Android 2.2 emulator? I'm also getting this error on the emulator but it works on the actual device (nexus one - android 2.2)
wo...@gmail.com <wo...@gmail.com> #13
Same error for me on 2.2 emulator. Haven't tried on actual device yet, but I'm glad I found this. Yikes.
wo...@gmail.com <wo...@gmail.com> #14
For info: If the Eclipse build properties link with the Google APIs level 7 and the target is AVD level 8 I still get the "Service not Available" IOException on coder.getFromLocationName. So it seems that the problem lies within the level 8 AVD not the API jars.
yb...@google.com <yb...@google.com> #15
Hi, I'm getting the same error too. Same codes that works on AVD 7, does not work on AVD 8. :(
yb...@google.com <yb...@google.com> #16
Please stop posting "I'm getting the same error" and the like. Remember that people get email everytime such a comment is posted.
Instead of posting such an uninformative comment, the design of the system is that you vote for the issue, so please do that instead.
Instead of posting such an uninformative comment, the design of the system is that you vote for the issue, so please do that instead.
wo...@gmail.com <wo...@gmail.com> #18
Just ran into this issue using the 2.2 Emulator...it's a bummer because I have nothing else to test on right now....my Droid X still hasn't gotten Froyo :/
be...@gmail.com <be...@gmail.com> #19
Please, we need a solution to this issue or at least a workaround
wo...@gmail.com <wo...@gmail.com> #20
AVDs tested on: Google API v7 (2.1-update1), Google API v8 (2.2)
Code that causes this issue for me:
List<Address> addresses = geocoder.getFromLocation(37.422006, -122.084095, 1);
Result using "Google API v7 (2.1-update1)": Works as intended.
Result using "Google API v8 (2.2)": Error - java.io.IOException: Service not Available
The stacktrace is essentially the same as the one posted by prashanth.babu (Comment 2 in this thread:http://code.google.com/p/android/issues/detail?id=8816#c2 ), except for the first line:
In prashanth.babu's stack trace, the first line is:
at android.location.Geocoder.getFromLocationName(Geocoder.java:159)
In my stack trace, the first line is:
at android.location.Geocoder.getFromLocation(Geocoder.java:117)
Code that causes this issue for me:
List<Address> addresses = geocoder.getFromLocation(37.422006, -122.084095, 1);
Result using "Google API v7 (2.1-update1)": Works as intended.
Result using "Google API v8 (2.2)": Error - java.io.IOException: Service not Available
The stacktrace is essentially the same as the one posted by prashanth.babu (Comment 2 in this thread:
In prashanth.babu's stack trace, the first line is:
at android.location.Geocoder.getFromLocationName(Geocoder.java:159)
In my stack trace, the first line is:
at android.location.Geocoder.getFromLocation(Geocoder.java:117)
be...@gmail.com <be...@gmail.com> #21
hi, i also meet the issue,but i found a solution. i use the kml to get the longitude and latitude,you can input address or train station name.
it almost work in any string.
the %E5%8F%B0%E5%8D%97%E7%81%AB%E8%BB%8A%E7%AB%99 is the String you want to know.
the string type is UTF-8.
http://maps.google.com.tw/maps?f=q&source=s_q&hl=zh-TW&geocode=&q=%E5%8F%B0%E5%8D%97%E7%81%AB%E8%BB%8A%E7%AB%99&ie=UTF8&0&om=0&output=kml
hope it can help.
it almost work in any string.
the %E5%8F%B0%E5%8D%97%E7%81%AB%E8%BB%8A%E7%AB%99 is the String you want to know.
the string type is UTF-8.
hope it can help.
be...@gmail.com <be...@gmail.com> #22
I have found a workaround to the issue. I used the standard google api: http://code.google.com/apis/maps/documentation/geocoding/
I have created a method that received a String address like "220+victoria+square" and returns a JSONObject with the response of the HTTP Call
public static JSONObject getLocationInfo(String address) {
HttpGet httpGet = new HttpGet("http://maps.google ."
+ "com/maps/api/geocode/json?address=" + address
+ "ka&sensor=false");
HttpClient client = new DefaultHttpClient();
HttpResponse response;
StringBuilder stringBuilder = new StringBuilder();
try {
response = client.execute(httpGet);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
int b;
while ((b = stream.read()) != -1) {
stringBuilder.append((char) b);
}
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject = new JSONObject(stringBuilder.toString());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jsonObject;
}
After executing this, another method converts that JSONObject into a GeoPoint.
public static GeoPoint getGeoPoint(JSONObject jsonObject) {
Double lon = new Double(0);
Double lat = new Double(0);
try {
lon = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lng");
lat = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
}
However this solution is extremely nasty and coupled..
I hope this helps
I have created a method that received a String address like "220+victoria+square" and returns a JSONObject with the response of the HTTP Call
public static JSONObject getLocationInfo(String address) {
HttpGet httpGet = new HttpGet("
+ "com/maps/api/geocode/json?address=" + address
+ "ka&sensor=false");
HttpClient client = new DefaultHttpClient();
HttpResponse response;
StringBuilder stringBuilder = new StringBuilder();
try {
response = client.execute(httpGet);
HttpEntity entity = response.getEntity();
InputStream stream = entity.getContent();
int b;
while ((b = stream.read()) != -1) {
stringBuilder.append((char) b);
}
} catch (ClientProtocolException e) {
} catch (IOException e) {
}
JSONObject jsonObject = new JSONObject();
try {
jsonObject = new JSONObject(stringBuilder.toString());
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return jsonObject;
}
After executing this, another method converts that JSONObject into a GeoPoint.
public static GeoPoint getGeoPoint(JSONObject jsonObject) {
Double lon = new Double(0);
Double lat = new Double(0);
try {
lon = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lng");
lat = ((JSONArray)jsonObject.get("results")).getJSONObject(0)
.getJSONObject("geometry").getJSONObject("location")
.getDouble("lat");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return new GeoPoint((int) (lat * 1E6), (int) (lon * 1E6));
}
However this solution is extremely nasty and coupled..
I hope this helps
ka...@beehyv.com <ka...@beehyv.com> #23
[Comment deleted]
yb...@google.com <yb...@google.com>
ra...@gmail.com <ra...@gmail.com> #24
[Comment deleted]
da...@google.com <da...@google.com> #25
Hii, Pablolarrimbe this is Dev your,s extremely nasty and coupled solution worked for me. Thanx bro...Only the address you are passing to the "getLocationInfo(String address)"
replace all blank spaces with %20. ex-> address = address.replaceAll(" ","%20"); Thats it....
replace all blank spaces with %20. ex-> address = address.replaceAll(" ","%20"); Thats it....
fa...@gmail.com <fa...@gmail.com> #26
Hi ,
Please provide solution for geoCoder.getFromLocation(
point.getLatitudeE6() / 1E6,
point.getLongitudeE6() / 1E6, 1) "Google API v8 (2.2)": Error - java.io.IOException: Service not Available
Thanks in advance
Samina
Please provide solution for geoCoder.getFromLocation(
point.getLatitudeE6() / 1E6,
point.getLongitudeE6() / 1E6, 1) "Google API v8 (2.2)": Error - java.io.IOException: Service not Available
Thanks in advance
Samina
mo...@mindtickle.com <mo...@mindtickle.com> #27
[Comment deleted]
du...@gmail.com <du...@gmail.com> #28
Alas, geocoding fails on a DEVICE for me. Android 1.5 and Android 1.6. Presumably it works OK on an Android 2.2 device.
Are you guys building against SDK 8 and intending to run on 1.5, 1.6, etc? Has anyone else had the same errors?
Are you guys building against SDK 8 and intending to run on 1.5, 1.6, etc? Has anyone else had the same errors?
Description
Version used: 1.0.0-beta2
Devices/Android versions reproduced on:
Consider the following code, added in an android library module (AAR):
@Entity(tableName = "my_table")
public class MyTable {
@PrimaryKey
@NonNull
public String id;
}
@Dao
public interface MyTableDao {
@Query("SELECT * FROM my_table WHERE id = :id")
LiveData<List<MyTable>> sampleQuery(String id);
}
The actual database is instantiated in the app module. When compiling, I receive the following error:
Error:Each bind variable in the query must have a matching method parameter. Cannot find method parameters for :id.
Error:Unused parameter: arg0
Renaming ":id" to ":arg0" in the query fixes the issue. It seems that AAR packages lose the parameter names, and this causes Room to fail to bind the parameters correctly. A similar issue happens when an entity constructor has a parameter ("Error:Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type).").