owntracks / android

OwnTracks Android App
http://owntracks.org
Eclipse Public License 1.0
1.37k stars 477 forks source link

Not display google maps when run apps #950

Closed ghost closed 3 years ago

ghost commented 3 years ago

I am trying to modify and add some features to owntracks by my own. I have downloaded the project but when I run it in Android Studio, the google maps displays nothings like this

So I think it may need to configure the google maps API key, but I have no idea where it is. Could you guys please tell me, where should I configure the API? Thanks in advance.

growse commented 3 years ago

Hi!

You should be able to follow the instructions in CONTRIBUTING.md to set the google maps API key. It's a little out of date, so I'll try to make sure that it's a bit clearer.

In essence, the API key comes from a gradle variable called google_maps_api_key. Setting this in your local gradle.properties file (typically in ~/.gradle) should let local builds access the SDK.

ghost commented 3 years ago

Hi!

You should be able to follow the instructions in CONTRIBUTING.md to set the google maps API key. It's a little out of date, so I'll try to make sure that it's a bit clearer.

In essence, the API key comes from a gradle variable called google_maps_api_key. Setting this in your local gradle.properties file (typically in ~/.gradle) should let local builds access the SDK.

Thanks for your help. I tried to add google_maps_api_key to gradle.proprerties but it didn't work as well. This is the result after entering api key and this is my api key and its configuration.

growse commented 3 years ago

From the exception in your first screenshot, it looks like it's still using the placeholder key as defined in the app gradle.properties.

I just tested adding the key in the project properties, and it should work.

Did you try doing a gradle clean / rebuild before installing & testing on the emulator?

ghost commented 3 years ago

From the exception in your first screenshot, it looks like it's still using the placeholder key as defined in the app gradle.properties.

I just tested adding the key in the project properties, and it should work.

Did you try doing a gradle clean / rebuild before installing & testing on the emulator?

I tried to clean and rebuild project after adding new api key. Moreover, I also tested on the new emulator but it did the same as the older

growse commented 3 years ago

Can you try updating the value in the gradle.properties inside project/app/?

ghost commented 3 years ago

Can you try updating the value in the gradle.properties inside project/app/?

hi, it runs like a charm. But I don't understand, why it didn't run when I add in gradle.properties as the instruction in CONTRIBUTING.md

growse commented 3 years ago

Unsure. It seems to work for me - if I add the google_maps_api_key line to the project gradle.properties, re-sync the project, clean/rebuild and run on the emulator, it works. Taking that line out and repeating gives the exception with the placeholder API key as before.

Same behaviour as if I use ~/.gradle/gradle.properties as well.

ghost commented 3 years ago

Unsure. It seems to work for me - if I add the google_maps_api_key line to the project gradle.properties, re-sync the project, clean/rebuild and run on the emulator, it works. Taking that line out and repeating gives the exception with the placeholder API key as before.

Same behaviour as if I use ~/.gradle/gradle.properties as well.

Anyway, thank you so much. :100: