0

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

Kenny Choi
  • 133
  • 1
  • 6
  • The package name does not matter. As long as you have Maps Service checked in Entitlement List in the Project Options, and a _valid_ Maps API Key, it should work. If it does not, please indicate the *exact* error(s) you are receiving – Dave Nottage Nov 23 '21 at 02:34

2 Answers2

1

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.

Kenny Choi
  • 133
  • 1
  • 6
0

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.

Bosshoss
  • 783
  • 6
  • 24
  • Yes, I follow the instruction on the page advised. However, the app still crush. – Kenny Choi Nov 22 '21 at 14:04
  • "That's all".. er, no. You need to also check the Maps checkbox in the Entitlements List in the Project Options. Please update your answer. – Dave Nottage Nov 22 '21 at 19:53
  • Thanks for your reminder but I still have no luck. In order to have a better illustration of my problem. I had captured some screenshots for the project and Google API settings. You may find the mentioned information in the pdf file under the following link: https://www.dropbox.com/sh/u8s7krnf8cpr18x/AADgK6owxklENQrnXxHzWJnSa?dl=0 . Many thanks!!! – Kenny Choi Nov 22 '21 at 23:18