我想创建一个类似于 applicationId 的全局变量.它是 build.gradle 中的设置值,将在 manifest 中使用.是否可以?
I want to create a global variable similar with applicationId. It is set value in build.gradle and will be used in manifest. Is it possible?
你可以设置,比如我是针对不同的产品风格设置的
You can set them, for instance I'm setting it for different product flavors
productFlavors {
production {
applicationId = "com.myapp.app"
resValue "string", "authority", "com.facebook.app.FacebookContentProvider5435651423234"
}
development {
applicationId = "com.myapp.development"
resValue "string", "authority", "com.facebook.app.FacebookContentProvider2134564533421"
}
qa {
applicationId = "com.myapp.qa"
resValue "string", "authority", "com.facebook.app.FacebookContentProvider29831237981287319"
}
}
并像这样使用它
<provider
android:name="com.facebook.FacebookContentProvider"
android:authorities="@string/authority"
android:exported="true" />
这篇关于在 gradle 中设置一个可以在清单文件中使用的全局变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!