How to define common android properties for all modules using gradle

前端 未结 8 2066
走了就别回头了
走了就别回头了 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:51

    Simply referencing 'android' closure from top level build doesn't work if top level build is not an android build. The 'android' method is not available until after evaluate. Originally, I had a working solution based on setting the config afterEvaluate but it no longer works (Android Studio 0.6.0):

    Android tasks have already been created. This happens when calling android.applicationVariants, android.libraryVariants or android.testVariants. Once these methods are called, it is not possible to continue configuring the model.

提交回复
热议问题