How to define common android properties for all modules using gradle

前端 未结 8 2065
走了就别回头了
走了就别回头了 2020-12-04 14:20

I create a simple project in AndroidStudio with a few modules. Each module\'s gradle script contains the following code:

android {
    compileSdkVersion 18
          


        
8条回答
  •  青春惊慌失措
    2020-12-04 14:55

    There is a new way simpler method, in the updated Android Studio. You have a file named "gradle.properties" in the top project hierarchy exactly for that. Simply define your parameters there:

    common_parameter='I am common"
    

    And use it in the modules' gradle files (build.gradle) as such:

    module_parameter = common_parameter
    

    That's it.

提交回复
热议问题