LeakCanary文档提到了以下处理构建类型的内容:
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
但是,如果同时使用多个product flavors
呢?我收到Gradle DSL method not found
有关buildTypeCompile
功能的错误。
这是我当前 Gradle 文件的骨架:
android {
...
dependencies {
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
ciCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
qaCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
uatCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
prodCompile 'com.squareup.leakcanary:leakcanary-android:1.3.1'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.3.1'
}
productFlavors {
foo {
buildTypes {
ci {
...
}
qa {
...
}
}
}
bar {
buildTypes {
ci {
...
}
qa {
...
}
}
}
}
}