错误:无此类属性:类com.android.build.gradle.managed.ProductFlavor的manifestPlaceholders [英] Error:No such property: manifestPlaceholders for class: com.android.build.gradle.managed.ProductFlavor
问题描述
我使用'gradle-experimental:0.4.0'
,我想在我的项目中使用onesignal sdk.当我尝试使用示例中提到的代码构建项目时,出现此错误:
I use 'gradle-experimental:0.4.0'
and I want to use onesignal sdk for my project. when I try to build the project with the code which have been mentioned in the example here I get this error:
错误:没有这样的属性:类的manifestPlaceholders: com.android.build.gradle.managed.ProductFlavor.
Error:No such property: manifestPlaceholders for class: com.android.build.gradle.managed.ProductFlavor.
示例代码
android {
defaultConfig {
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: "bbbbbb-324f-34fd-bed1-df8f05be55ba",
onesignal_google_project_number: "11111111"]
}
}
我的项目中的代码
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "com.myproject.company"
manifestPlaceholders = [manifestApplicationId: "${applicationId}",
onesignal_app_id: "234jfi4-2342-4a23-234-24235436546",
onesignal_google_project_number: "111111111"]
minSdkVersion.apiLevel = 16
targetSdkVersion.apiLevel = 23
versionCode = 3
}
互联网搜索没有发现任何结果.我该怎么办才能消除此错误?
Internet search revealed nothing. What should I do to remove this error?
推荐答案
我浏览了gradle-experimental的源代码,并在最新提交上看到了manifestPlaceholders上的TODO,因此似乎尚不支持.
I looked through the source code of gradle-experimental and I see a TODO on manifestPlaceholders on the latest commit so it looks like it isn't support yet. https://android.googlesource.com/platform/tools/base/+/6e2ee9ad8a0aeff3231f9937e46cc663aa2a64c5/build-system/gradle-experimental/src/main/groovy/com/android/build/gradle/managed/ProductFlavor.java#97
如果必须使用gradle-experimental而不是普通发行版,则需要使用OneSignal的jar版本并手动添加AndroidManifest.xml条目.有关说明,请参阅OneSignal Eclipse设置中的步骤2 .清单条目.
If you must use gradle-experimental instead of the normal release you will need to use the jar version of OneSignal and add the AndroidManifest.xml entries manually. See step 2 in OneSignal's Eclipse setup for instructions the manifest entries.
谢谢.
这篇关于错误:无此类属性:类com.android.build.gradle.managed.ProductFlavor的manifestPlaceholders的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!