Google PlacePicker Closes Immediately After Launch
I am developing an Android Application and was looking into Google Places for some functionality within the application. Google has recently released the PlacePicker feature which is what I am using. I have followed the Google guidelines and quick start guides to the "T". The functionality was working amazing as of three hours ago and now when I go to test it, it launches and then immediately closes with no errors thrown in the stack trace. Here is how I am using the code:
This is within a fragment.
// The Location Selection from Google Place Picker
where.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
This is within the fragments onCreateView.
The method launchPlace() is defined as follows.
// Start Google Place Picker Code **************************************************************
public void launchPlace() throws GooglePlayServicesNotAvailableException,
GooglePlayServicesRepairableException {
PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getActivity().getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
String badLocation = "That location is not valid for this app, please select a valid location";
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
place = PlacePicker.getPlace(data, getActivity().getApplicationContext());
if (place.getPlaceTypes().contains(34)) {
if (place.getPlaceTypes().contains(9) || place.getPlaceTypes().contains(15) ||
place.getPlaceTypes().contains(38) ||
place.getPlaceTypes().contains(67) ||
place.getPlaceTypes().contains(79)) {
where.setText(place.getName());
loc = true;
} else {
Toast.makeText(getActivity().getApplicationContext(),
badLocation, Toast.LENGTH_LONG).show();
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
}
}
}
}
This code worked previously (3 hours ago) and now does not. Here is what LogCat says: (Android Studio)
04-21 15:48:02.320 5045-5045/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 15:48:02.680 5045-5124/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa1a55600 (InsetDrawable) with handle 0xa185dff0
04-21 15:48:05.000 5045-5121/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 15:48:05.060 5045-5045/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@215c768a time:9757022
If anyone knows of a way to help with this that would be amazing, I know that Google PlacePicker is quite new but I am a novice Android Developer and feel like someone has a better understanding than I. Any and all help would be appreciated. If more information is required please let me know. We use GitHub so I have reverted all the way back to when it once worked, yet nothing changed, it still closes (the picker, not the app). I have enabled the Google Places API and Google Places API for Android in the developer console, no help there either. It gets to the "Updating your location" screen then stops.
EDIT: This is the entire LogCat, from launch (On a Samsung Galaxy S5) to the PlacePicker starting (One navigation prior to that action) then closing and returning to the app. Is this what you meant?
04-21 16:56:26.740 27318-27318/com.siliconmindtech.trofi D/ResourcesManager﹕ creating new AssetManager and set to /data/app/com.siliconmindtech.trofi-1/base.apk
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isShipBuild true
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Thread-13137-1066627414: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call secproduct feature valuefalse
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call debug elastic valuetrue
04-21 16:56:26.950 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.970 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Render dirty regions requested: true
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
OpenGL ES Shader Compiler Version: E031.25.01.03
Build Date: 10/28/14 Tue
Local Branch: LA.BF.1.1_RB1_20141028_021_patches2
Remote Branch:
Local Patches:
Reconstruct Branch:
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ Initialized EGL, version 1.4
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0xa23090d8 ,&mEglDisplay = 1 , &mEglConfig = 8
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Enabling debug mode 0
04-21 16:56:27.050 27318-27340/com.siliconmindtech.trofi I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-21 16:56:27.240 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ Application requested CPU execution
04-21 16:56:27.260 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ 0xa2377a00 Launching thread(s), CPUs 4
04-21 16:56:27.310 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13859270
04-21 16:56:29.700 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.850 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.970 27318-27318/com.siliconmindtech.trofi I/Places﹕ Got here!
04-21 16:56:32.300 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa196d600 (InsetDrawable) with handle 0xaf7fc350
04-21 16:56:32.740 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13864703
The above LogCat is Verbose.
Solution: Don't be a newbie like me, I had forgotten to add my Google API Key to my android_manifest.xml... I apologize.
android android-fragments google-places
add a comment |
I am developing an Android Application and was looking into Google Places for some functionality within the application. Google has recently released the PlacePicker feature which is what I am using. I have followed the Google guidelines and quick start guides to the "T". The functionality was working amazing as of three hours ago and now when I go to test it, it launches and then immediately closes with no errors thrown in the stack trace. Here is how I am using the code:
This is within a fragment.
// The Location Selection from Google Place Picker
where.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
This is within the fragments onCreateView.
The method launchPlace() is defined as follows.
// Start Google Place Picker Code **************************************************************
public void launchPlace() throws GooglePlayServicesNotAvailableException,
GooglePlayServicesRepairableException {
PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getActivity().getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
String badLocation = "That location is not valid for this app, please select a valid location";
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
place = PlacePicker.getPlace(data, getActivity().getApplicationContext());
if (place.getPlaceTypes().contains(34)) {
if (place.getPlaceTypes().contains(9) || place.getPlaceTypes().contains(15) ||
place.getPlaceTypes().contains(38) ||
place.getPlaceTypes().contains(67) ||
place.getPlaceTypes().contains(79)) {
where.setText(place.getName());
loc = true;
} else {
Toast.makeText(getActivity().getApplicationContext(),
badLocation, Toast.LENGTH_LONG).show();
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
}
}
}
}
This code worked previously (3 hours ago) and now does not. Here is what LogCat says: (Android Studio)
04-21 15:48:02.320 5045-5045/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 15:48:02.680 5045-5124/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa1a55600 (InsetDrawable) with handle 0xa185dff0
04-21 15:48:05.000 5045-5121/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 15:48:05.060 5045-5045/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@215c768a time:9757022
If anyone knows of a way to help with this that would be amazing, I know that Google PlacePicker is quite new but I am a novice Android Developer and feel like someone has a better understanding than I. Any and all help would be appreciated. If more information is required please let me know. We use GitHub so I have reverted all the way back to when it once worked, yet nothing changed, it still closes (the picker, not the app). I have enabled the Google Places API and Google Places API for Android in the developer console, no help there either. It gets to the "Updating your location" screen then stops.
EDIT: This is the entire LogCat, from launch (On a Samsung Galaxy S5) to the PlacePicker starting (One navigation prior to that action) then closing and returning to the app. Is this what you meant?
04-21 16:56:26.740 27318-27318/com.siliconmindtech.trofi D/ResourcesManager﹕ creating new AssetManager and set to /data/app/com.siliconmindtech.trofi-1/base.apk
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isShipBuild true
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Thread-13137-1066627414: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call secproduct feature valuefalse
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call debug elastic valuetrue
04-21 16:56:26.950 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.970 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Render dirty regions requested: true
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
OpenGL ES Shader Compiler Version: E031.25.01.03
Build Date: 10/28/14 Tue
Local Branch: LA.BF.1.1_RB1_20141028_021_patches2
Remote Branch:
Local Patches:
Reconstruct Branch:
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ Initialized EGL, version 1.4
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0xa23090d8 ,&mEglDisplay = 1 , &mEglConfig = 8
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Enabling debug mode 0
04-21 16:56:27.050 27318-27340/com.siliconmindtech.trofi I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-21 16:56:27.240 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ Application requested CPU execution
04-21 16:56:27.260 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ 0xa2377a00 Launching thread(s), CPUs 4
04-21 16:56:27.310 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13859270
04-21 16:56:29.700 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.850 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.970 27318-27318/com.siliconmindtech.trofi I/Places﹕ Got here!
04-21 16:56:32.300 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa196d600 (InsetDrawable) with handle 0xaf7fc350
04-21 16:56:32.740 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13864703
The above LogCat is Verbose.
Solution: Don't be a newbie like me, I had forgotten to add my Google API Key to my android_manifest.xml... I apologize.
android android-fragments google-places
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14
add a comment |
I am developing an Android Application and was looking into Google Places for some functionality within the application. Google has recently released the PlacePicker feature which is what I am using. I have followed the Google guidelines and quick start guides to the "T". The functionality was working amazing as of three hours ago and now when I go to test it, it launches and then immediately closes with no errors thrown in the stack trace. Here is how I am using the code:
This is within a fragment.
// The Location Selection from Google Place Picker
where.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
This is within the fragments onCreateView.
The method launchPlace() is defined as follows.
// Start Google Place Picker Code **************************************************************
public void launchPlace() throws GooglePlayServicesNotAvailableException,
GooglePlayServicesRepairableException {
PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getActivity().getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
String badLocation = "That location is not valid for this app, please select a valid location";
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
place = PlacePicker.getPlace(data, getActivity().getApplicationContext());
if (place.getPlaceTypes().contains(34)) {
if (place.getPlaceTypes().contains(9) || place.getPlaceTypes().contains(15) ||
place.getPlaceTypes().contains(38) ||
place.getPlaceTypes().contains(67) ||
place.getPlaceTypes().contains(79)) {
where.setText(place.getName());
loc = true;
} else {
Toast.makeText(getActivity().getApplicationContext(),
badLocation, Toast.LENGTH_LONG).show();
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
}
}
}
}
This code worked previously (3 hours ago) and now does not. Here is what LogCat says: (Android Studio)
04-21 15:48:02.320 5045-5045/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 15:48:02.680 5045-5124/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa1a55600 (InsetDrawable) with handle 0xa185dff0
04-21 15:48:05.000 5045-5121/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 15:48:05.060 5045-5045/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@215c768a time:9757022
If anyone knows of a way to help with this that would be amazing, I know that Google PlacePicker is quite new but I am a novice Android Developer and feel like someone has a better understanding than I. Any and all help would be appreciated. If more information is required please let me know. We use GitHub so I have reverted all the way back to when it once worked, yet nothing changed, it still closes (the picker, not the app). I have enabled the Google Places API and Google Places API for Android in the developer console, no help there either. It gets to the "Updating your location" screen then stops.
EDIT: This is the entire LogCat, from launch (On a Samsung Galaxy S5) to the PlacePicker starting (One navigation prior to that action) then closing and returning to the app. Is this what you meant?
04-21 16:56:26.740 27318-27318/com.siliconmindtech.trofi D/ResourcesManager﹕ creating new AssetManager and set to /data/app/com.siliconmindtech.trofi-1/base.apk
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isShipBuild true
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Thread-13137-1066627414: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call secproduct feature valuefalse
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call debug elastic valuetrue
04-21 16:56:26.950 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.970 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Render dirty regions requested: true
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
OpenGL ES Shader Compiler Version: E031.25.01.03
Build Date: 10/28/14 Tue
Local Branch: LA.BF.1.1_RB1_20141028_021_patches2
Remote Branch:
Local Patches:
Reconstruct Branch:
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ Initialized EGL, version 1.4
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0xa23090d8 ,&mEglDisplay = 1 , &mEglConfig = 8
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Enabling debug mode 0
04-21 16:56:27.050 27318-27340/com.siliconmindtech.trofi I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-21 16:56:27.240 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ Application requested CPU execution
04-21 16:56:27.260 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ 0xa2377a00 Launching thread(s), CPUs 4
04-21 16:56:27.310 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13859270
04-21 16:56:29.700 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.850 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.970 27318-27318/com.siliconmindtech.trofi I/Places﹕ Got here!
04-21 16:56:32.300 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa196d600 (InsetDrawable) with handle 0xaf7fc350
04-21 16:56:32.740 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13864703
The above LogCat is Verbose.
Solution: Don't be a newbie like me, I had forgotten to add my Google API Key to my android_manifest.xml... I apologize.
android android-fragments google-places
I am developing an Android Application and was looking into Google Places for some functionality within the application. Google has recently released the PlacePicker feature which is what I am using. I have followed the Google guidelines and quick start guides to the "T". The functionality was working amazing as of three hours ago and now when I go to test it, it launches and then immediately closes with no errors thrown in the stack trace. Here is how I am using the code:
This is within a fragment.
// The Location Selection from Google Place Picker
where.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
});
This is within the fragments onCreateView.
The method launchPlace() is defined as follows.
// Start Google Place Picker Code **************************************************************
public void launchPlace() throws GooglePlayServicesNotAvailableException,
GooglePlayServicesRepairableException {
PLACE_PICKER_REQUEST = 1;
PlacePicker.IntentBuilder builder = new PlacePicker.IntentBuilder();
Context context = getActivity().getApplicationContext();
startActivityForResult(builder.build(context), PLACE_PICKER_REQUEST);
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {
String badLocation = "That location is not valid for this app, please select a valid location";
if (requestCode == PLACE_PICKER_REQUEST) {
if (resultCode == Activity.RESULT_OK) {
place = PlacePicker.getPlace(data, getActivity().getApplicationContext());
if (place.getPlaceTypes().contains(34)) {
if (place.getPlaceTypes().contains(9) || place.getPlaceTypes().contains(15) ||
place.getPlaceTypes().contains(38) ||
place.getPlaceTypes().contains(67) ||
place.getPlaceTypes().contains(79)) {
where.setText(place.getName());
loc = true;
} else {
Toast.makeText(getActivity().getApplicationContext(),
badLocation, Toast.LENGTH_LONG).show();
try {
launchPlace();
} catch (GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) {
e.printStackTrace();
}
}
}
}
}
}
This code worked previously (3 hours ago) and now does not. Here is what LogCat says: (Android Studio)
04-21 15:48:02.320 5045-5045/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 15:48:02.680 5045-5124/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa1a55600 (InsetDrawable) with handle 0xa185dff0
04-21 15:48:05.000 5045-5121/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 15:48:05.060 5045-5045/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@215c768a time:9757022
If anyone knows of a way to help with this that would be amazing, I know that Google PlacePicker is quite new but I am a novice Android Developer and feel like someone has a better understanding than I. Any and all help would be appreciated. If more information is required please let me know. We use GitHub so I have reverted all the way back to when it once worked, yet nothing changed, it still closes (the picker, not the app). I have enabled the Google Places API and Google Places API for Android in the developer console, no help there either. It gets to the "Updating your location" screen then stops.
EDIT: This is the entire LogCat, from launch (On a Samsung Galaxy S5) to the PlacePicker starting (One navigation prior to that action) then closing and returning to the app. Is this what you meant?
04-21 16:56:26.740 27318-27318/com.siliconmindtech.trofi D/ResourcesManager﹕ creating new AssetManager and set to /data/app/com.siliconmindtech.trofi-1/base.apk
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isShipBuild true
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Thread-13137-1066627414: SmartBonding Enabling is false, SHIP_BUILD is true, log to file is false, DBG is false
04-21 16:56:26.910 27318-27340/com.siliconmindtech.trofi I/System.out﹕ (HTTPLog)-Static: isSBSettingEnabled false
04-21 16:56:26.910 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call secproduct feature valuefalse
04-21 16:56:26.940 27318-27318/com.siliconmindtech.trofi D/Activity﹕ performCreate Call debug elastic valuetrue
04-21 16:56:26.950 27318-27318/com.siliconmindtech.trofi D/AbsListView﹕ Get MotionRecognitionManager
04-21 16:56:26.970 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Render dirty regions requested: true
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/Adreno-EGL﹕ <qeglDrvAPI_eglInitialize:410>: EGL 1.4 QUALCOMM build: ()
OpenGL ES Shader Compiler Version: E031.25.01.03
Build Date: 10/28/14 Tue
Local Branch: LA.BF.1.1_RB1_20141028_021_patches2
Remote Branch:
Local Patches:
Reconstruct Branch:
04-21 16:56:27.030 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ Initialized EGL, version 1.4
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi I/OpenGLRenderer﹕ HWUI protection enabled for context , &this =0xa23090d8 ,&mEglDisplay = 1 , &mEglConfig = 8
04-21 16:56:27.050 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ Enabling debug mode 0
04-21 16:56:27.050 27318-27340/com.siliconmindtech.trofi I/System.out﹕ KnoxVpnUidStorageknoxVpnSupported API value returned is false
04-21 16:56:27.240 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ Application requested CPU execution
04-21 16:56:27.260 27318-27350/com.siliconmindtech.trofi V/RenderScript﹕ 0xa2377a00 Launching thread(s), CPUs 4
04-21 16:56:27.310 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13859270
04-21 16:56:29.700 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.850 27318-27318/com.siliconmindtech.trofi D/ViewRootImpl﹕ ViewPostImeInputStage ACTION_DOWN
04-21 16:56:31.970 27318-27318/com.siliconmindtech.trofi I/Places﹕ Got here!
04-21 16:56:32.300 27318-27350/com.siliconmindtech.trofi D/OpenGLRenderer﹕ endAllStagingAnimators on 0xa196d600 (InsetDrawable) with handle 0xaf7fc350
04-21 16:56:32.740 27318-27318/com.siliconmindtech.trofi I/Timeline﹕ Timeline: Activity_idle id: android.os.BinderProxy@344b9848 time:13864703
The above LogCat is Verbose.
Solution: Don't be a newbie like me, I had forgotten to add my Google API Key to my android_manifest.xml... I apologize.
android android-fragments google-places
android android-fragments google-places
edited Apr 26 '15 at 10:16
Mattia Maestrini
25.6k146579
25.6k146579
asked Apr 21 '15 at 20:00
Cole LaidlawCole Laidlaw
2131310
2131310
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14
add a comment |
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14
add a comment |
7 Answers
7
active
oldest
votes
Just enable Google Places API for Android in your Google Developer Console.
Don't forget to specify your API key at AndroidManifest
:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs forPlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…
– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at yourAndroidManifest
I believe.
– fraggjkee
Apr 26 '15 at 9:46
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
|
show 3 more comments
I believe that when Google made changes to their API's on 04/20/2015 they modified the places API that the PlacePicker inherently uses. The solution that worked for me is as follows:
- Go to your Google Developer Console (https://console.developers.google.com/project)
- Navigate to your project if you have made one. If not go here: https://developers.google.com/console/help/
- Navigate to "APIs & auth" then to "Credentials" on the left side of the console. I don't have enough rep to post a picture for guidance...
- Create a new Key, this appears under Public API access in your Credentials window. You will need your SHA1 Fingerprint to receive the key. Directions that I used are here: How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
- The location that you input your SHA1 Fingerprint should be in this format:
(Your Key, 20 Hex values separated by ":");com.yourpackage.yourapp - Copy your API Key that is generated. You will need to add the fingerprint of each developer in the same format above for it to work for other developers.
- Add your key to your AndroidManifest.xml
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
Where the "@string/google_api_key" /> is the key that you just generated. Place it in your strings.xml file as such:
<string name="google_api_key">yourkeyhere</string>
- Clean and Rebuild your project. Should be working now. I don't think I left any steps out... Please comment if I have.
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
|
show 2 more comments
I have the same issue. I add Google map key
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` in manifest file.
The Place Picker closes immediately. Then, i also add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
The Place Picker shows, but when i open map, my app was force close, and log like below.
RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.maps.v2.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:364)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzj(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1763)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:456)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
I try to remove
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` but keep `<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
And It's working well, now, and I don't know why.
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
add a comment |
replace your meta data tag in the mainfeast .. it works for me ..
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR ANDROID KEY" />
with
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID KEY" />
good luck
add a comment |
I had the same problems using the Places API. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link:
https://developers.google.com/places/android-api/signup
add a comment |
in my case GO to Google COnsole then Enabled API for Android Google Places, then Go to Manifest.xml and put this code under
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and dont forget to put Google API key
add a comment |
How i fixed this error was when getting an API key (On Google Developers Page) , the location where you enter your package name enter your complete package name. This is available in your android manifest!
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29781978%2fgoogle-placepicker-closes-immediately-after-launch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
7 Answers
7
active
oldest
votes
7 Answers
7
active
oldest
votes
active
oldest
votes
active
oldest
votes
Just enable Google Places API for Android in your Google Developer Console.
Don't forget to specify your API key at AndroidManifest
:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs forPlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…
– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at yourAndroidManifest
I believe.
– fraggjkee
Apr 26 '15 at 9:46
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
|
show 3 more comments
Just enable Google Places API for Android in your Google Developer Console.
Don't forget to specify your API key at AndroidManifest
:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs forPlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…
– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at yourAndroidManifest
I believe.
– fraggjkee
Apr 26 '15 at 9:46
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
|
show 3 more comments
Just enable Google Places API for Android in your Google Developer Console.
Don't forget to specify your API key at AndroidManifest
:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />
Just enable Google Places API for Android in your Google Developer Console.
Don't forget to specify your API key at AndroidManifest
:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="ADD_YOUR_API_KEY_HERE" />
edited Apr 26 '15 at 9:49
answered Apr 22 '15 at 19:59
fraggjkeefraggjkee
1,73712127
1,73712127
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs forPlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…
– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at yourAndroidManifest
I believe.
– fraggjkee
Apr 26 '15 at 9:46
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
|
show 3 more comments
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs forPlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…
– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at yourAndroidManifest
I believe.
– fraggjkee
Apr 26 '15 at 9:46
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
2
2
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
This isn't correct. Or at least, it isn't the whole fix.
– lbrendanl
Apr 25 '15 at 19:49
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
The great thing about the PlacePicker is that you don't need any API's. Google handled all of that for you, hence the usefulness of the PlacePicker. Documentation to support this answer here: developers.google.com/places/android/placepicker
– Cole Laidlaw
Apr 26 '15 at 1:52
@ColeLaidlaw I would like do disagree that you don'y need any APIs for
PlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…– fraggjkee
Apr 26 '15 at 9:45
@ColeLaidlaw I would like do disagree that you don'y need any APIs for
PlacePicker
. At least, the official sample app requires your API key to be specified at AndroidManifest: github.com/googlesamples/android-play-places/blob/master/…– fraggjkee
Apr 26 '15 at 9:45
@lbrendanl yes, the whole fix also includes a correct API key at your
AndroidManifest
I believe.– fraggjkee
Apr 26 '15 at 9:46
@lbrendanl yes, the whole fix also includes a correct API key at your
AndroidManifest
I believe.– fraggjkee
Apr 26 '15 at 9:46
1
1
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
But, I'll send the bounty to you since it answered the original question, I will open another for my issue.
– lbrendanl
Apr 26 '15 at 18:13
|
show 3 more comments
I believe that when Google made changes to their API's on 04/20/2015 they modified the places API that the PlacePicker inherently uses. The solution that worked for me is as follows:
- Go to your Google Developer Console (https://console.developers.google.com/project)
- Navigate to your project if you have made one. If not go here: https://developers.google.com/console/help/
- Navigate to "APIs & auth" then to "Credentials" on the left side of the console. I don't have enough rep to post a picture for guidance...
- Create a new Key, this appears under Public API access in your Credentials window. You will need your SHA1 Fingerprint to receive the key. Directions that I used are here: How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
- The location that you input your SHA1 Fingerprint should be in this format:
(Your Key, 20 Hex values separated by ":");com.yourpackage.yourapp - Copy your API Key that is generated. You will need to add the fingerprint of each developer in the same format above for it to work for other developers.
- Add your key to your AndroidManifest.xml
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
Where the "@string/google_api_key" /> is the key that you just generated. Place it in your strings.xml file as such:
<string name="google_api_key">yourkeyhere</string>
- Clean and Rebuild your project. Should be working now. I don't think I left any steps out... Please comment if I have.
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
|
show 2 more comments
I believe that when Google made changes to their API's on 04/20/2015 they modified the places API that the PlacePicker inherently uses. The solution that worked for me is as follows:
- Go to your Google Developer Console (https://console.developers.google.com/project)
- Navigate to your project if you have made one. If not go here: https://developers.google.com/console/help/
- Navigate to "APIs & auth" then to "Credentials" on the left side of the console. I don't have enough rep to post a picture for guidance...
- Create a new Key, this appears under Public API access in your Credentials window. You will need your SHA1 Fingerprint to receive the key. Directions that I used are here: How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
- The location that you input your SHA1 Fingerprint should be in this format:
(Your Key, 20 Hex values separated by ":");com.yourpackage.yourapp - Copy your API Key that is generated. You will need to add the fingerprint of each developer in the same format above for it to work for other developers.
- Add your key to your AndroidManifest.xml
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
Where the "@string/google_api_key" /> is the key that you just generated. Place it in your strings.xml file as such:
<string name="google_api_key">yourkeyhere</string>
- Clean and Rebuild your project. Should be working now. I don't think I left any steps out... Please comment if I have.
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
|
show 2 more comments
I believe that when Google made changes to their API's on 04/20/2015 they modified the places API that the PlacePicker inherently uses. The solution that worked for me is as follows:
- Go to your Google Developer Console (https://console.developers.google.com/project)
- Navigate to your project if you have made one. If not go here: https://developers.google.com/console/help/
- Navigate to "APIs & auth" then to "Credentials" on the left side of the console. I don't have enough rep to post a picture for guidance...
- Create a new Key, this appears under Public API access in your Credentials window. You will need your SHA1 Fingerprint to receive the key. Directions that I used are here: How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
- The location that you input your SHA1 Fingerprint should be in this format:
(Your Key, 20 Hex values separated by ":");com.yourpackage.yourapp - Copy your API Key that is generated. You will need to add the fingerprint of each developer in the same format above for it to work for other developers.
- Add your key to your AndroidManifest.xml
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
Where the "@string/google_api_key" /> is the key that you just generated. Place it in your strings.xml file as such:
<string name="google_api_key">yourkeyhere</string>
- Clean and Rebuild your project. Should be working now. I don't think I left any steps out... Please comment if I have.
I believe that when Google made changes to their API's on 04/20/2015 they modified the places API that the PlacePicker inherently uses. The solution that worked for me is as follows:
- Go to your Google Developer Console (https://console.developers.google.com/project)
- Navigate to your project if you have made one. If not go here: https://developers.google.com/console/help/
- Navigate to "APIs & auth" then to "Credentials" on the left side of the console. I don't have enough rep to post a picture for guidance...
- Create a new Key, this appears under Public API access in your Credentials window. You will need your SHA1 Fingerprint to receive the key. Directions that I used are here: How to get the SHA-1 fingerprint certificate in Android Studio for debug mode?
- The location that you input your SHA1 Fingerprint should be in this format:
(Your Key, 20 Hex values separated by ":");com.yourpackage.yourapp - Copy your API Key that is generated. You will need to add the fingerprint of each developer in the same format above for it to work for other developers.
- Add your key to your AndroidManifest.xml
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
Where the "@string/google_api_key" /> is the key that you just generated. Place it in your strings.xml file as such:
<string name="google_api_key">yourkeyhere</string>
- Clean and Rebuild your project. Should be working now. I don't think I left any steps out... Please comment if I have.
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
<application ...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
... </application>
edited May 23 '17 at 11:47
Community♦
11
11
answered Apr 26 '15 at 1:49
Cole LaidlawCole Laidlaw
2131310
2131310
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
|
show 2 more comments
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, these are the exact steps outlined in the Places API documentation.
– lbrendanl
Apr 26 '15 at 18:09
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
Yes, but that was the fix that worked for me. The documentation wasn't very clear about having to follow the previous pages. When you navigate to the PlacePicker page it isn't very clear, it's actually quite vague and doesn't remind the developer to take such actions.
– Cole Laidlaw
Apr 27 '15 at 11:08
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:
05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
This works only in debug for me, not release. Once I sign the apk, it's back to the original behavior. I've even removed all SHA1 Fingerprint from the Key, and it says "Any application allowed". This is the error I get:
05-05 07:59:27.448 1622-24823/? W/Places﹕ f.a:597: gLocReplyElement unsuccessful status: 1 05-05 07:59:27.449 1622-24823/? W/Places﹕ f.a:624: gPlaceQueryResult unsuccessful responseCode: 31 05-05 07:59:27.450 23097-24837/? E/PlacePicker﹕ NETWORK_ERROR
– Todd DeLand
May 5 '15 at 12:04
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
I personally have not attempted a release yet, when I generate the release and test I will respond with an answer. However the error is saying that the PlacePicker is returning a NETWORK_ERROR, I assume you have the Internet Access and Fine Location Permissions enabled in the AndroidManifest.xml ?
– Cole Laidlaw
May 5 '15 at 23:30
2
2
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
Brand new project worked great, debug and release versions. Turns out it's a very odd bug in the Google Developer Console Project. I had shared the particular project with a user in a "Google Apps" account. This is where things went bad. Once I removed the user (and regenerated the key), everything worked normally. I'll try to find a place to report such a bug. Hope this helps others.
– Todd DeLand
May 7 '15 at 0:29
|
show 2 more comments
I have the same issue. I add Google map key
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` in manifest file.
The Place Picker closes immediately. Then, i also add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
The Place Picker shows, but when i open map, my app was force close, and log like below.
RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.maps.v2.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:364)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzj(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1763)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:456)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
I try to remove
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` but keep `<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
And It's working well, now, and I don't know why.
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
add a comment |
I have the same issue. I add Google map key
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` in manifest file.
The Place Picker closes immediately. Then, i also add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
The Place Picker shows, but when i open map, my app was force close, and log like below.
RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.maps.v2.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:364)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzj(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1763)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:456)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
I try to remove
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` but keep `<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
And It's working well, now, and I don't know why.
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
add a comment |
I have the same issue. I add Google map key
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` in manifest file.
The Place Picker closes immediately. Then, i also add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
The Place Picker shows, but when i open map, my app was force close, and log like below.
RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.maps.v2.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:364)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzj(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1763)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:456)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
I try to remove
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` but keep `<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
And It's working well, now, and I don't know why.
I have the same issue. I add Google map key
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` in manifest file.
The Place Picker closes immediately. Then, i also add
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
The Place Picker shows, but when i open map, my app was force close, and log like below.
RuntimeException: The API key can only be specified once. It is recommended that you use the meta-data tag with the name: com.google.android.maps.v2.API_KEY in the <application> element of AndroidManifest.xml
at com.google.maps.api.android.lib6.d.fb.a(Unknown Source)
at com.google.maps.api.android.lib6.a.g.a(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.CreatorImpl.b(Unknown Source)
at com.google.android.gms.maps.internal.i.onTransact(SourceFile:62)
at android.os.Binder.transact(Binder.java:364)
at com.google.android.gms.maps.internal.zzc$zza$zza.zzj(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zzqs(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment$zzb.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.zza(Unknown Source)
at com.google.android.gms.dynamic.zza.onCreate(Unknown Source)
at com.google.android.gms.maps.SupportMapFragment.onCreate(Unknown Source)
at android.support.v4.app.Fragment.performCreate(Fragment.java:1763)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:915)
at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1136)
at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:739)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1499)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:456)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5103)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:606)
at dalvik.system.NativeStart.main(Native Method)
I try to remove
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="@string/google_maps_key"/>` but keep `<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_api_key" />
And It's working well, now, and I don't know why.
edited Nov 9 '17 at 14:30
Tirolel
52431232
52431232
answered Apr 27 '15 at 9:07
thethanhthethanh
514
514
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
add a comment |
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I believe the v2 was deprecated. That is why you had to switch.
– Cole Laidlaw
Apr 27 '15 at 11:05
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
I had the same problem. Turns out you should only use one or the other. Recommended you use the android.geo metadata since it supports multiple Google Maps-Api. Found the answer here: developers.google.com/maps/documentation/android-api/signup
– ChallengeAccepted
Sep 14 '15 at 12:07
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
"As shown above, com.google.android.geo.API_KEY is the recommended metadata name for the API key. A key with this name can be used to authenticate to multiple Google Maps-based APIs on the Android platform, including the Google Maps Android API. For backwards compatibility, the API also supports the name com.google.android.maps.v2.API_KEY. This legacy name allows authentication to the Android Maps API v2 only. An application can specify only one of the API key metadata names. If both are specified, the API throws an exception."
– ChallengeAccepted
Sep 14 '15 at 12:08
add a comment |
replace your meta data tag in the mainfeast .. it works for me ..
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR ANDROID KEY" />
with
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID KEY" />
good luck
add a comment |
replace your meta data tag in the mainfeast .. it works for me ..
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR ANDROID KEY" />
with
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID KEY" />
good luck
add a comment |
replace your meta data tag in the mainfeast .. it works for me ..
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR ANDROID KEY" />
with
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID KEY" />
good luck
replace your meta data tag in the mainfeast .. it works for me ..
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="YOUR ANDROID KEY" />
with
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="YOUR ANDROID KEY" />
good luck
answered Sep 29 '15 at 9:50
ahmed ewessahmed ewess
1869
1869
add a comment |
add a comment |
I had the same problems using the Places API. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link:
https://developers.google.com/places/android-api/signup
add a comment |
I had the same problems using the Places API. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link:
https://developers.google.com/places/android-api/signup
add a comment |
I had the same problems using the Places API. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link:
https://developers.google.com/places/android-api/signup
I had the same problems using the Places API. At the end, I figured out that there are different Google Places APIs especially for Android. Consequently, the API-Key that I was using was simply for the non-Android version.
Generate your key using this link:
https://developers.google.com/places/android-api/signup
answered Oct 8 '17 at 18:46
bsautermeisterbsautermeister
766717
766717
add a comment |
add a comment |
in my case GO to Google COnsole then Enabled API for Android Google Places, then Go to Manifest.xml and put this code under
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and dont forget to put Google API key
add a comment |
in my case GO to Google COnsole then Enabled API for Android Google Places, then Go to Manifest.xml and put this code under
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and dont forget to put Google API key
add a comment |
in my case GO to Google COnsole then Enabled API for Android Google Places, then Go to Manifest.xml and put this code under
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and dont forget to put Google API key
in my case GO to Google COnsole then Enabled API for Android Google Places, then Go to Manifest.xml and put this code under
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/google_maps_key" />
<meta-data
android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
and dont forget to put Google API key
answered Nov 14 '18 at 6:22
Yudi karmaYudi karma
238
238
add a comment |
add a comment |
How i fixed this error was when getting an API key (On Google Developers Page) , the location where you enter your package name enter your complete package name. This is available in your android manifest!
add a comment |
How i fixed this error was when getting an API key (On Google Developers Page) , the location where you enter your package name enter your complete package name. This is available in your android manifest!
add a comment |
How i fixed this error was when getting an API key (On Google Developers Page) , the location where you enter your package name enter your complete package name. This is available in your android manifest!
How i fixed this error was when getting an API key (On Google Developers Page) , the location where you enter your package name enter your complete package name. This is available in your android manifest!
answered Oct 3 '15 at 12:34
faizsameerahmed96faizsameerahmed96
114
114
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f29781978%2fgoogle-placepicker-closes-immediately-after-launch%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Show the exception in the log cat.
– Jared Burrows
Apr 21 '15 at 20:50
Printing the Exceptions to the LogCat yields no change from the above log. The sample code they have on GitHub is also broken in the same way. Experience that here: github.com/googlesamples/android-play-places/tree/master/… I used the PlacePicker.
– Cole Laidlaw
Apr 22 '15 at 1:28
Post your solution as an answer.
– Jared Burrows
Apr 22 '15 at 4:22
I also have the same problem. My app was working a week ago, but now it does not. I didn't change anything...
– Andranik
Apr 24 '15 at 18:14