BuildConfig not getting created correctly (Gradle Android)

前端 未结 10 744
一生所求
一生所求 2020-12-14 14:07

I am trying to convert our Android application to a gradle build. I have the project and it\'s libraries building successfully. I am now trying to create separate apks fo

10条回答
  •  感情败类
    2020-12-14 14:41

    Please, be sure that you are building "dev" or "prod" variant. There is no BuildConfig definition in default "debug" and "release" variant. In Android Studio, you can select current variant in bottom left corner:

    Build Variants

    To simplify your build.gradle file, you can define:

    buildTypes {
        debug {
            buildConfigField "String", "URL_SEARCH", "\"https://dev-search.example.com\""
            // etc.
        }
        release {
            buildConfigField "String", "URL_SEARCH", "\"https://search.example.com\""
            // etc.      
        }
    }
    

    and then just use default "debug" and "release" variants.

    At last, delete semicolon (sign: ';') from the value of buildConfigField parameter.

提交回复
热议问题