English 中文(简体)
如何自动产生一个地方。 履历
原标题:How to automatically generate a local.properties file with Android Studio

对一个标准项目而言,当地“properties”档案在B.gitignore被忽略,不应在来源代码背书上实施,而应如何在Adhura的演播室中开启一个新的陈列项目?

显然,你可以人工创建一个新的地方。 财产档案把失踪的零件铺开,但很常见,如果无法启动一个基本项目,自动完成缺失的物品,为什么要使用像安乐施会这样的完全的电离层系统?

或许有正常的标准方法(没有人工填满的档案)......你们知道如何在方案上这样做?

具有讽刺意味的是,原始档案中有一种信息,如“DO NOT EDIT THIS FILE”的演播室,将自动地加以改造,但――而且” ; HOW ?

问题回答

在您的<代码>build.gradle文档中,你忽略了当地情况。 不动产需要重新计算,添加这一方法:

def createMissingFiles() {
    // Create empty file if not existed
    def propertiesFile = file( src/path/to/your/file/local.properties )
    if (!propertiesFile.exists()) {
        file("src/path/to/your/file/").mkdirs()
        propertiesFile.createNewFile()
    }
}

然后在<代码>android{}部分附后build.gradle内使用这种方法。 档案

android {
    signingConfigs {. }
    compileSdkVersion ...
    
    // Let gradle build check and create the missing files for you
    createMissingFiles()

    defaultConfig {.  }
}

这种方法要求每个格拉斯建筑群,以便你能够删除档案,再次点击格拉斯建筑纽顿,以测试。





相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...

热门标签