Error:No such property: manifestPlaceholders for class: com.android.build.gradle.managed.ProductFlavor

时光怂恿深爱的人放手 提交于 2019-12-07 10:12:29

问题


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:

Error:No such property: manifestPlaceholders for class: com.android.build.gradle.managed.ProductFlavor.

Code in Sample

android {
    defaultConfig {
        manifestPlaceholders = [manifestApplicationId: "${applicationId}",
                                onesignal_app_id: "bbbbbb-324f-34fd-bed1-df8f05be55ba",
                                onesignal_google_project_number: "11111111"]
    }
 }

Code in my project

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?


回答1:


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

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.

Thanks.



来源:https://stackoverflow.com/questions/35167483/errorno-such-property-manifestplaceholders-for-class-com-android-build-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!