I am learning to build Android Google Map app on RAD Studio 11. However, I got crush when the app is being launched. If I change the API key point to another package name, the app can be launched but the map is empty.
Do anyone know what is the matter? How could I fix the problem? Many thanks in advance.
Regards,
Kenny
After several investigations, the problem of the crash is caused by that the following line should be added back into the file "AndroidManifest.xml"
uses-library android:name="org.apache.http.legacy" android:required="false"
Remark: The < /> bracket are removed from the line above in order to correctly display the line content. Please add them back when you put the line back into the .XML file.
After Android 6, support for the Apache HTTP client has been removed and starting from Android 9, that library is removed from the bootclasspath and which is not available to android apps by default. As such, the aforesaid line should be added back to the "AndroidManifest.xml" file.
First, an API key is mandatory.
You need to create a project in Google Cloud Platform and enable Maps SDK for Android. When it's done you will get an API key.
On your Firemonkey application, you can add a TMapView.
In project options > Application > Version info. > add a new line, with key apiKey and value the api key you get from Google.
You need to also check the Maps checkbox in the Entitlements List in the Project Options.
That's all. You can do it in All configuration or only Android 32/64 bits.
Check what version you run, and set the apiKey correctly.
Otherwise, this page describe you what I told : https://docwiki.embarcadero.com/RADStudio/Sydney/en/Mobile_Tutorial:_Using_a_Map_Component_to_Work_with_Maps_(iOS_and_Android)
If the Map is empty, it's possible that you didn't use the correct API.
Related
OK, I'm having the weirdest bug right now : the Android application I'm working on is displaying a grey background instead of the map, such as below :
(source: hostingpics.net)
Here's the logcat :
04-25 15:08:42.082: E/Google Maps Android API(19139): Failed to load map. Could not contact Google servers.
04-25 15:08:42.082: W/Google Maps Android API(19139): Please add <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> into AndroidManifest.xml to ensure correct behavior under poor connectivity conditions.
I have NO idea what might have caused this. I only changed a small part of my code that was completely unrelated to the map. And besides, I tried reverting the changes I made, and it still didn't work. I tried adding the line the logcat gave me, changing the API key, re-installing the Google Play library, deleting the previous versions of my app on my tablet, basically pretty much everything that I read on the Internet. Still doesn't work.
If anyone has any idea what the problem might be, that would be great.
This problem is caused when there is a problem with your key or a problem with it's configuration in the Google API Console.
Go over this blog post I wrote on how to produce the key and integrate in in the console:
Google Maps API V2 key
if this is not helpful you can try to delete the dubug.keystore folder in you user folder, compile
some project in eclipe (which result in regenerating this key) and try to register it again.
UPDATE:
From the new error you posted, do you have this permission in your manifest file:
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
Try this: set the “Custom debug keystore” setting (empty by default) to the same value as the “Default debug keystore” in the Eclipse preferences.
Emil's post above helped me, I was getting the same error and realised that this was due to me changing the name of my project. I added the changed name along with the same SHA1 I had for my old project on a new line (leaving the one with the old name above) in the console and it seemed to work as normal.
I followed the google maps tutorial to create a new google maps project, obtained an api key, included the , and the INTERNET permissions in the manifest file. Included
in the main.xml file, and followed the steps to modify the main.java file. The app will install to the emulator, but as soon as I click on the app, a notifications shows:
The application has stopped unexpectedly.
I have exhausted all resources, so hopefully someone can help. Thanks in advance for all of the help. Also, in the logcat, I am getting a number of errors after I "click" on the app in the emulator. One error in particular that I have read about, but not found a fix for is:
Caused by: java.lang.ClassNotFoundException: com.hutzley.TestMap.MyApplication in loader dalvik.system.PathClassLoader
Something in your app is trying to refer to com.hutzley.TestMap.MyApplication, and this class does not exist in your project. Since a reference from Java would typically generate a compile error, I recommend that you check your manifest, find where this is referenced, and change it to whatever it is supposed to be.
Make sure you are using one of the special emulator images which supports the Google APIs, without this you would be trying to run your app on an environment that lacks required libraries for maps to work.
Im just tryng to put admob (4.3.1) on a android app (3.3, api 10) on eclipse (Version: 3.7.2)
following the google tutorial, at the start i have a error on
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
and then in Adding a com.google.ads.adview... I just didint know what to do, I tried 2 or 3 times, but it's not clear to me if I have to delete the Import from my project and put that or put below or above. I downloaded the sample but I seem to have errors in the activity.
So I just tried to create a banner XML and with no problems. I saved as a .apk, put on my phone (the device what I gave the device ID for test) and it just won't open, it forces close every time I try. I have almost 10 free apps on the market just waiting for ads.
Your problem is that api 10 is version 2.3.3, not 3.3. The screenSize and smallestScreenSize configChanges required by AdMob were not introduced into the Android framework until Android 3.2 (api 13). So if your project.properties has something lower than android-13, your app simply won't compile.
As for adding the AdView, I'm not sure I understand your problem. The example code is open-sourced here. Perhaps you could point to the line that is giving you issues.
I want to use the Google Maps API in my Project.
I signed up and got the API key also.
When I run my application now I'm getting an error "Error generating final archive: Invalid keystore"
I m really fed up. It is very difficult to use Maps in an application.
Do you know what the problem is in this case?
I think you may have problem with "debug.keystore",
Go through this example: http://mobiforge.com/developing/story/using-google-maps-android,
read Obtaining a Maps API key paragraph carefully, hope this link useful to you.
Also refer this Tutorial .
Have you been having this problem with your other Android projects? Is your Windows locale NOT set to English, United States? If so, then this bug may apply to you
If it does not, then please post more info about how you are using the Map in your application. For example, please post the layout code where you use the map, and/or any relavant code. Include the file where you are setting your API key.
Finally, have you tried project->clean? You may want to be sure that your eclipse, your android SDK, and your android eclipse plugin (aka ADT) are all fully up to date before trying to clean the project!
I am new to Android software development and new to this site. I am hoping someone might have some experience with the problem I am having.
I've been following the Hello, MapView tutorial in order to not only learn the Android framework, but also the Google Maps library. I've tried my best to implement things exactly as the tutorial has instructed. My problem is that the application does load in my emulator (or even on my phone for that matter), but the map tiles do not load.
Searching Google I found a post by someone else on another site having the same issue, but his/her problem was that the important elements added to the AndroidManifest.xml file were not in the right order. I double-checked this in mine, but everything seems to be right.
So, I am not sure what the issue is and was hoping others have seen this before. I can provide any snippets of code, if that would help.
Thank you.
Non-loading tiles are usually the result of not having the API key set up correctly. Obtaining a Maps API key
To answer the response you left to d.: If you want to have it "just work" when you run from Eclipse you'll need to get an API key for your debug certificate. There's instructions on the same page as before. Do note that you'll have to swap back to your other key before publishing though.
I am guessing the issue is not that you have an incorrect map key, but that you do not have the proper keystore setup. The application needs to be signed by the same keystore you used to generate the map key. You've noted that you can get it to work when you sign the application yourself, but you need to setup a debug keystore in order to use the Maps API with regular Eclipse builds.
All Eclipse builds require a debug keystore; you just normally don't notice it because ADT generates one for you automatically. You should either follow the directions here and create your own debug keystore, or you should take the debug key that ADT automatically created for you (it'll show you where it created it in Windows > Preferences > Android > Build) and sign up for another Maps API key. That key will work with Eclipse.
(P.S., this does make it a hassle to compile for release, as you need to switch your key back and forth depending on the signing keystore.)
I had the issue of tiles not loading as well. As you mentioned your original post, one possibility is with the ordering of elements in the AndroidManifest.xml file. Specifically, I originally had the line:
<uses-permission android:name="android.permission.INTERNET" />
after the application element. Once I moved this line before the application element, my map tiles started loading again.
The tiles not loading is almost always a result of using an inaccurate API-key, i think. Have you checked yours?
Details: Obtaining a Maps API key
I had the same problem... my error was in the manifest file puting INTERNET permissions inside application. After moveing it out (upside) everying was working good.
Make sure you have 3g on the top panel. If you don't then there is no internet connection. Sometimes I have to turn the emulator on and off a couple of times to get 3g to come up.
d. is probably correct. However, Internet problems will also cause similar symptoms. Be sure that your INTERNET permission is properly positioned and that there are no proxy servers/firewalls impeding access to the Internet.
Another problem could be a proxy that you are behind. The proxy slows things down a lot and it will effect your app even though the maps app and internet browser in the emulator work fine.
This is old question, but here is one more answer: if you are as hasty as me, you might accidentally copy the finger print code instead of API key from the web page :)
The Hello, MapView tutorial your were talking about is no longer valid. New V1 map applications can no longer be done.
Follow https://developers.google.com/maps/documentation/android/ for Google Maps Android API v2 applications.