I am trying to get the basic Google Maps example to work
https://developers.google.com/maps/documentation/android-api/start
Unfortunately, whenever I run it on the emulator using Geny, the screen is blank. After some searching, I am seeing others say that I should verify that both the app/src/debug/google_maps_api.xml and app/src/release/google_maps_api.xml have the key I created.
I have verified that app/src/main/res/values/google_maps_pi.xml has the key, but the other directories for debug and release do not exist.
I have synced my project with gradle files and still not seeing them.
Any ideas would be appreciated.
If you are adding Google maps to an existing project, using this tutorial as a basis,
https://developers.google.com/maps/documentation/android-api/start
then you must first create a new project using the maps activity wizard in Android Studio. Copy and paste the various differences mentioned in the tutorial such as the manifest.xml, build.gradle, and google_maps_api.xml.
The one thing I did not realize I needed to do was copy the directories app/src/debug and app/src/release from the new project to my existing one.
Once that is done then you can confirm that app/src/res/values/google_maps_pi.xml and app/src/res/release/google_maps_api.xml are using the same API you created.
Related
I'm setting up Firebase Crashlytics for my Android app, and I would like the crash reports for the debug version to be separate from all other versions.
There are several copies of the auto-generated values.xml file (that is generated when the google-services plugin processes toe google-services.json file) located in the different retrospective buildType folders. One of the strings contained in the files is:
<string name="google_crash_reporting_api_key" translatable="false">{API-KEY}</string>
The API key is the same for each buildType, so I'm thinking if I can just create a new API key for the debug version, it'll solve the problem but how to do this? Or is there another way (that doesn't involve changing the applicationId as I can't do this)?
I've searched the android docs, looked up other articles and looked through other SO answers but no luck.
Any help welcomed, thank you.
You cannot differentiate the crash as per the build type (debug version).
You have to create a new project in the firebase with same app details (package name).
Get the API key for the project and then replace that key in your manifest file and DONE.
You just have to replace the key when you change your build Type.
I have a working Android app using:
Google Maps (play-services-maps)
Google Location, Activity Recognition, and Places (play-services-location)
Google Analytics (play-services-analytics)
Google Mobile Ads (play-services-ads)
I'm currently using version 8.3.0, everything works fine. I'd like to upgrade to the last version, 9.2.0. When I change the number in the gradle files, Android Studio is unable to find the APIs packages & classes (saying "package XXX does not exist" and "Cannot find symbol class YYY").
I currently have no google-services.json file, do I need it now? I tried without success, probably because I have several modules / submodules, and I don't know where the json file is needed or not.
The problem is that I need a package name to create the JSON file, and I have some library modules, without package name, using Google APIs.
If needed, here is the project structure:
Maybe you did something wrong while upgrading your project. Make sure you follow the correct steps in upgrading. I suggest you to retry the process of upgrading, but make sure you do the correct way. Like in configuring your build and setting up Google play service.
For your question about google-services.json, Google-services.json contains developer credentials and configuration settings, which is needed to verify while connecting with GoogleApiClient. Though your service is working fine without it. But it will only work with your test device, as it is detecting your developer account. And after you releae your app in public, it will not work without the json file. So you need it and don't delete.
sources: What does google-services.json really do?
So, I finally got it: I was using the AutocompletePrediction.getDescription() method, which has simply been removed (and replaced by AutocompletePrediction.getDescription .getFullText()). That call made gradle stops building -_- .
Thanks Google for removing stuff without deprecating it for a while (though the docs says that the method is deprecated: https://developers.google.com/places/android-api/releases)...
I can also confirm that in my case, the google-service.json file is NOT required.
I am building an Android app that I want to open google maps with the click of a button. I want the app to find the current location of the user and give them directions to a predefined address. I started building the application before I realized there were special steps that you have to take to include this functionality. To add this feature to my project I followed the directions on these two sites:
https://developer.android.com/google/play-services/setup.html
https://developer.android.com/tools/projects/projects-eclipse.html#ReferencingLibraryProject
The problem is on the second site, when i added the library to my already existing project it caused all of my code that has findViewById(R.id.whatever) or setContentView(R.layout.whatever) to become errors. It is now telling me that i need to import the class R. If I do that it then gives me error messages on the names of all my xml files.
For example in my MainActivity it is telling me that i should change setContentView(R.layout.activity_main) to setContentView(R.layout.activity_list_item) and does this for all references to my xml files for the entire project.
I tried going back and removing the google play services library from the project and starting over but when I removed it the errors still persists. I also tried using the "fix project setup" option in Eclipse but it didn't fix the problem.
I'm wondering if anyone here has experienced this problem before? If so, how can I fix it? The application had no errors before I tried to include the google play services library. I am new to Android development so a lot of the information I have found has been either confusing to understand or doesn't seem to include enough details for me to figure it out. Thanks for your help!
Look at your imports, and check if you are importing the correct R.java from your application package, not from the android package.
Check also if your XMLs don't contain errors, otherwise R.java won't be generated.
In my case android-maps-library had to errors in two files (I have forgotten their names), I edited the two files removing errors my self. And finally I was able to used it quite nice.
i think you have correct yout Project build target, and this how:
right click on your project folder in the package explorer->propreties->Android
then porject build target and choose you Android target (Android x.xx)
but before that you need to remove import android.R;
I have been working with Java for about a couple of months now and I have been stuck introducing Google API into my Maps app. I need some help with these imports.
Here is what I did: I was following the code of a Places API demo which I can link if needed. I ended up having to add some libraries. Before I did, I was getting errors from all of the imports that started with com.google.api.client...etc. Then once I added all of these libraries, I then got left with 2 errors out of my imports.
The errors are: the "com.google.api.client.googleapis.GoogleHeaders" and "com.google.api.client.http.json.JsonHttpParser". I am receiving them both as "cannot be resolved to a type". These errors are causing some more errors throughout the rest of my code. I was hoping someone can help me solve this. I know it should have something to do with my code, but I am not sure what is going on. I know I am missing something.
Also, I installed the Google Plugin to install the APIs and when I did, I added the "Google + API" and the "GoogleOAuth2" APIs and that is where I am stuck at. Please someone help.
Here is the screenshot: Full Screenshot
I haven't worked with Maps, but as I understand it Maps is now packaged with Google Play Services, which I have been working with recently.
Firstly, the installation of Google Play Services is well-documented and you should look at this (if you haven't done so already):
http://developer.android.com/google/play-services/setup.html
There are a few areas that cause difficulty, and one is the section "Set Up a Project with the Library". There are different possible approaches but I suggest you take the following steps.
Ensure that the Google Play Services lib (and any other libs) are defined as library projects (Properties ...Android.. Library ...IsLibrary) and that they have no errors (cleaning may not be sufficient - you may have to shut down Eclipse to remove the errors).
When the library projects are error free, add them to your project. The normal way of doing this is to REFERENCE them (check what the documentation says) but you do this by (Properties ...Android.. Library ...Add).
Then check out (Properties ... Java Build Path ...) - read the documentation but you need your libs in here.
Then clean your project but note that a restart of Eclipse may be necessary to remove the errors from your project.
There are other errors that can arise - another common one arises if you have different versions of the v4 support lib in your libs / project and you get a message "...this check is based on SHA1 at this time". This is well documented on Stack Overflow.
Good luck !
I created one android application I followed all the steps to make API keys and intalled google play services from Android SDK Manager. I read so many blogs for integartion google map, I Import the libraty project to my worksapce from "\adt-bundle-windows-x86\sdk\extras\google\google_play_services\libproject\google-play-services_lib" path. when I tried to add library project from project's property window in android tab I got following out put
But when I check this library second time than I got following out put in android tab
I have proble of libraty project. I used eclipse IDE. I got some solution but for different IDE , so suggest me for best solution..
The first problem usually happens when the path to the library is too long, the solution would be to move the google-play-services lib to a place where it path would be shorter and then try to reference it again.
your second problem:
"Google Maps Android API(23127): Failed to load map. Could not contact Google servers."
caused usually when there is a problem with your API key or a problem with the permissions you have defined in the manifest file, take a look a this post I wrote and go over all the steps to generate the key:
Google Map API key
Next, check steps 5-7 and verify you defined the right permissions:
Google Map API V2
Sometimes it may happen, you should remove and add the same library again
or restart the eclipse and add the library