I recently migrated my android project from Eclipse to Android Studio. My project currently has the following Gradle script structure:
- Gradle Top Level Assembly File
- Main module (my application) Gradle build file
- module A (my application) Gradle build file
- module B (my application) Gradle build file
- C module (my application) Gradle build file
The contents of my main Gradle build file:
// Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { repositories { mavenCentral() maven { url 'http://download.crashlytics.com/maven' } } dependencies { classpath 'com.android.tools.build:gradle:1.2.1' classpath 'com.crashlytics.tools.gradle:crashlytics-gradle:1.+' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files } } allprojects { repositories { maven { url "http://dl.bintray.com/populov/maven" } mavenCentral() } }
I would like to make sure that starches will be presented for the entire project. At first I tried to add
apply plugin: 'crashlytics'
to the main Gradle project file, but I found the following error:
Error: (2, 0) Crashlytics was applied to a project without an Android plugin. Please ensure that the Crashlytics plugin is applied after the appropriate Android plugin for your project.
Then I moved the apply plugin: 'crashlytics' to the build module assembly file (my application) Gradle, and the build was successful.
Since I am new to Gradle and Android Studio, I was not sure I needed this also for submodules A, B, C to allow crashlytics to catch exceptions thrown from these modules. I am also wondering why I canβt (or how I can) add "apply plugin:" crashlytics "to the main Gradle project file.
Can anyone clarify this for me?
source share