Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/gwt/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Gradle:保存属性文件_Android_Gradle_Properties File - Fatal编程技术网

Android Gradle:保存属性文件

Android Gradle:保存属性文件,android,gradle,properties-file,Android,Gradle,Properties File,我在我的项目中使用NewRelic。它需要带有应用程序令牌的newrelic.properties文件。我需要用不同的令牌创建几个构建。在gradle for genereting属性中,我使用下一个代码段: Properties props = new Properties() props.setProperty("com.newrelic.application_token","MYTOKEN") 如何将其保存到我的应用程序文件夹?我需要根文件夹中文本为“com.newrelic.appl

我在我的项目中使用NewRelic。它需要带有应用程序令牌的newrelic.properties文件。我需要用不同的令牌创建几个构建。在gradle for genereting属性中,我使用下一个代码段:

Properties props = new Properties()
props.setProperty("com.newrelic.application_token","MYTOKEN")

如何将其保存到我的应用程序文件夹?我需要根文件夹中文本为“com.newrelic.application\u token=MYTOKEN”的“newrelic.properties”文件。

您可以使用-p标志指示生成配置文件:

gradle clean build -Pprofile=dev
然后在构建脚本中使用它:

File propsFile = new File('/libs/newrelic.properties')
if (project.getProperty('profile') == "dev") {
    println "Target environment: $profile"
    Properties props = new Properties()
    props.setProperty("com.newrelic.application_token","DEV_TOKEN")
    props.store(propsFile.newWriter(), null)
}

您可以使用-p标志指示生成配置文件:

gradle clean build -Pprofile=dev
然后在构建脚本中使用它:

File propsFile = new File('/libs/newrelic.properties')
if (project.getProperty('profile') == "dev") {
    println "Target environment: $profile"
    Properties props = new Properties()
    props.setProperty("com.newrelic.application_token","DEV_TOKEN")
    props.store(propsFile.newWriter(), null)
}

您可以使用-p标志指示生成配置文件:

gradle clean build -Pprofile=dev
然后在构建脚本中使用它:

File propsFile = new File('/libs/newrelic.properties')
if (project.getProperty('profile') == "dev") {
    println "Target environment: $profile"
    Properties props = new Properties()
    props.setProperty("com.newrelic.application_token","DEV_TOKEN")
    props.store(propsFile.newWriter(), null)
}

您可以使用-p标志指示生成配置文件:

gradle clean build -Pprofile=dev
然后在构建脚本中使用它:

File propsFile = new File('/libs/newrelic.properties')
if (project.getProperty('profile') == "dev") {
    println "Target environment: $profile"
    Properties props = new Properties()
    props.setProperty("com.newrelic.application_token","DEV_TOKEN")
    props.store(propsFile.newWriter(), null)
}
我使用更简单的方法:

ant.propertyfile(file: "newrelic.properties") {
            entry( key: "com.newrelic.application_token", value: "AA165ad2e3e518***********************sd2")
        }
由此: 我使用更简单的方法:

ant.propertyfile(file: "newrelic.properties") {
            entry( key: "com.newrelic.application_token", value: "AA165ad2e3e518***********************sd2")
        }
由此: 我使用更简单的方法:

ant.propertyfile(file: "newrelic.properties") {
            entry( key: "com.newrelic.application_token", value: "AA165ad2e3e518***********************sd2")
        }
由此: 我使用更简单的方法:

ant.propertyfile(file: "newrelic.properties") {
            entry( key: "com.newrelic.application_token", value: "AA165ad2e3e518***********************sd2")
        }
由此: