我正在为地图构建一个新的应用程序。在创建新项目之后,Android期待在local.properties文件中定义属性,但我不知道如何定义属性。所以,请帮我解决这个问题。说明如下。
TODO: Before you run your application, you need a Google Maps API key.
To get one, follow the directions here:
https://developers.google.com/maps/documentation/android-sdk/get-api-key
Once you have your API key (it starts with "AIza"), define a new property in your
project's local.properties file (e.g. MAPS_API_KEY=Aiza...), and replace the
"YOUR_API_KEY" string in this file with "${MAPS_API_KEY}".
发布于 2022-04-08 10:30:39
从google获得API密钥后,请执行以下操作:
local.properties定位
发布于 2022-03-19 20:55:02
如果您想用键sdk.dir定义一个属性,那么将它放在一个local.properties中,如下所示
(x86)\Android\android-studio\sdk sdk.dir=C:\Program文件
如果要在其他区域使用此属性,可以使用以下代码片段
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdkDir = properties.getProperty('sdk.dir')
def ndkDir = properties.getProperty('ndk.dir')
如果要在子项目project.rootProject中读取属性文件,请使用build.gradle,否则使用
properties.load(project.rootProject.file('local.properties').newDataInputStream())
https://stackoverflow.com/questions/71541688
复制相似问题