I created a new Google Maps Activity, and the only thing I did was stick my API key into the .xml file. When I run the project, I get an: "Error: '-' is not a valid resource name character" in the .xml file. What is wrong with the project, and how can I fix the error? .xml file error
i had this error, mainly it is where you place the key... Replace the YOUR_KEY in the code with your API key that start with Alza
from
<string name="google_maps_key"
templateMergeStrategy="preserve"
translatable="false">YOUR_KEY</string>
to
<string name="google_maps_key"
templateMergeStrategy="preserve"
translatable="false">AIzaSyBs8wUvJW-zOZixEiPmedagyrW8Y7VcW4I</string>
in your android studio on google_maps_api.xml there will something like this :
You can also add your credentials to an existing key, using this line: 47:2A:E4:BC:00:1D:21:E2:FA:20:B9:AB:70:FB:75:E7:23:16:37:C1;com.example.radio.demomap
notice that it is separated by a semicolon
47:2A:E4:BC:00:1D:21:E2:FA:20:B9:AB:70:FB:75:E7:23:16:37:C1 ; com.example.radio.demomap
now when you go to google console developer to create credentials
example
type your package name and fingerprint certificate key and enter create you will get your correct key
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With