How to specify gradle file to build Adroid project in Android Studio project structure?


(Kai Mi) #1

For some reasons, I need to specify another gradle file (not using the default one - build.gradle ) to build Android project in Android Studio project structure.
I have an Android Studio standard project structure as below.

   -->Root
      -->app
          -->settings.gradle 
          -->build.gradle
      -->Project1 (library)
      -->Project2 (library)
      -->build.gradle
      -->settings.gradle

I want to create a new gradle file to build project to generate apk file. This gradle file has some tasks than the default one (build.gradle).

So I can choose one of them to use for different purpose.

For example, for A purpose, I can execute ‘gradle assembledebug’ to generate apk file.
for B purpose, I can execute ‘gradle assembledebug -b b.gradle’ to generate apk file.

I have done some research on this, but failed.

Does anyone know how to do it?