Bis*_*hoo 5 android android-studio
我正在构建一个新的地图应用程序。创建新项目后,Android studio 期望在 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}".
Run Code Online (Sandbox Code Playgroud)
从 Google 获取 API 密钥后,请执行以下操作:
小智 2
如果您想使用键 sdk.dir 定义属性,则将其放入 local.properties 中,如下所示
sdk.dir=C:\Program Files (x86)\Android\android-studio\sdk
要在其他区域使用此属性,您可以使用此代码片段
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
def sdkDir = properties.getProperty('sdk.dir')
def ndkDir = properties.getProperty('ndk.dir')
Run Code Online (Sandbox Code Playgroud)
如果您正在读取子项目 build.gradle 中的属性文件,请使用project.rootProject,否则使用
properties.load(project.rootProject.file('local.properties').newDataInputStream())
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7285 次 |
| 最近记录: |