我正在使用Android Studio构建我的应用程序。我想使用gradlebuildTypes。我使用applicationIdSuffix为包名添加后缀,以修改测试生成类型的包名
构建类型{
调试{
runProguard false
proguard文件“proguard rules.txt”
applicationIdSuffix'.dev'
版本名称uffix'-dev'
}
}
是否可以在xml文件中使用此信息。我的计划是修改帐户类型:
<;帐户验证器xmlns:android=”http://schemas.android.com/apk/res/android"
android:accountType=<&书信电报;此处的包装名称??>&燃气轮机;
android:icon=“@drawable/icon”
android:label=“@string/app_name”/>;
谢谢
在Android Gradle插件获得对资源文件中占位符的支持之前,还有一个临时解决方案
您可以在defaultConfig和/或buildTypes和/或productFlavors闭包中通过Gradle动态创建字符串资源:
安卓{
默认配置{
applicationId’com.foo.bar’
resValue’string’,’package_name’,applicationId
}
}
然后,您可以在authenticator.xml文件中引用它,就像您对标签所做的那样:
<;帐户验证器xmlns:android=”http://schemas.android.com/apk/res/android"
android:accountType=“@string/package\u name”
android:icon=“@drawable/icon”
android:label=“@string/app_name”/>;