Can't load Android Kotlin project into Fabric beta with gradle
I created a project with Android Studio Preview 3.0 (Canary 2) to start developing Kotlin. I used Android Studio Fabric plugin to set up Fabric for my project.
But when I want to upload the beta of my application to Fabric Beta (Crashlytics) with the following command
./gradlew crashlyticsUploadDistributionDebug
I am getting the following error:
The 'compile' configuration in the ': app' project is deprecated. using "implementation". The 'testCompile' configuration in the ': app' project is deprecated. Use 'testImplementation' instead. The Task.leftShift (Closure) method is deprecated and should be removed in Gradle 5.0. Use Task.doLast (Action) instead. registerResGeneratingTask is deprecated, use registerGeneratedFolders (FileCollection) registerResGeneratingTask is deprecated, use registerGeneratedFolders (FileCollection): app: crashlyticsUploadDistributionDebug FAILED
FAILURE: Build failed with exception.
What went wrong: Execution failed for task ': app: crashlyticsUploadDistributionDebug'.
Not valid.
Try it: run with the -stacktrace option to get a stack trace. Run with the -info or --debug option to get more log output.
BUILD FAILED in 1s 1 actionable task: 1 completed, 0 excluded (0%)
I don't know what "Invalid" means.
This is my root build.gradle
:
buildscript {
ext.kotlin_version = '1.1.2-4'
repositories {
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'org.ajoberstar:grgit:1.9.0'
classpath 'io.fabric.tools:gradle:1.22.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
ext {
supportLibVersion = "25.3.1"
buildVersion = "25.0.3"
daggerVersion = "2.9"
rxJavaVersion = "2.1.0"
rxAndroidVersion = "2.0.1"
countGitCommits = { ->
git = Grgit.open()
def commitCount = git.log(includes: ['HEAD']).size()
println("INFO: Number of commits $commitCount")
return commitCount
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://maven.fabric.io/public' }
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And this app build.gradle
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "$buildVersion"
defaultConfig {
applicationId "com.kotlin.sample"
minSdkVersion 21
targetSdkVersion 25
def numberOfCommits = countGitCommits()
versionCode 1000 + numberOfCommits
versionName "0.1.$numberOfCommits"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile files('libs/API_ADK.jar')
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile "com.android.support:appcompat-v7:$supportLibVersion"
compile "com.android.support:support-v4:$supportLibVersion"
compile "com.android.support:design:$supportLibVersion"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'io.reactivex.rxjava2:rxkotlin:2.0.3'
compile "io.reactivex.rxjava2:rxandroid:$rxAndroidVersion"
compile "io.reactivex.rxjava2:rxjava:$rxJavaVersion"
compile 'com.jakewharton.timber:timber:4.5.1'
compile "com.google.dagger:dagger:$daggerVersion"
// Needed for @Generated annotation (missing in Java <= 1.6; therefore, Android)
compile 'javax.annotation:jsr250-api:1.0'
compile('com.crashlytics.sdk.android:crashlytics:2.6.8@aar') {
transitive = true;
}
kapt "com.google.dagger:dagger-compiler:$daggerVersion"
testCompile 'junit:junit:4.12'
}
The fabric.properties
apiSecret file is also placed in the project.
Edit:
Manually uploading an APK to Fabric Beta.
source to share
I just want to point to Mike Bonnell's comment as he answers this question:
Our command line tools are incompatible with the alpha version of Gradle 3. We are investigating the changes that came with the alphas, but we are testing beta and stable releases.
Edit 2017/08/25
Tried with Android Studio 3.0 Beta 3 and the corresponding android Gradle plugin. The Gradle task crashlyticsUploadDistributionDebug
seems to be working again.
source to share