Reputation: 5498
My Android app has a third build type "qa". I followed these instructions from LeakCanary's site: "if you have other build types than debug and release, you need to add a specific dependency for those too (xxxCompile)":
qaImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.6.2'
This results in a gradle sync error:
Could not find method qaImplementation() for arguments [com.squareup.leakcanary:leakcanary-android-no-op:1.6.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
The same happens if I do qaCompile
. Here are my build types:
buildTypes {
debug {
applicationIdSuffix ".debug"
versionNameSuffix " Dev"
}
qa {
zipAlignEnabled true
signingConfig signingConfigs.releaseConfig
versionNameSuffix " Test"
}
release {
signingConfig signingConfigs.releaseConfig
zipAlignEnabled true
}
flavorDimensions "app" // Required by Gradle 3
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
The instructions seem totally straightforward so I don't see what I might be missing. Anyone have experience getting this setup to work?
Upvotes: 5
Views: 1720
Reputation: 12304
Correct, as the author said - add implementation with prefix of buildType.
For example, I have custom buildType called releaseFreemium
. It takes all settings from build type - release - without additional options.
More info here https://developer.android.com/studio/build/build-variants .
Answer in FAQ of LeakCanary (https://github.com/square/leakcanary/wiki/FAQ#how-do-i-fix-build-errors).
Upvotes: 4