ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

无法使用gradle将Android Kotlin项目上传到Fabric Beta

2019-08-28 13:26:29  阅读:343  来源: 互联网

标签:android crashlytics kotlin


我用Android Studio Preview 3.0(Canary 2)创建了一个项目来开始Kotlin开发.我使用Android Studio Fabric插件为我的项目设置Fabric.

但是,当我想使用以下命令将我的应用程序的测试版上传到Fabric Beta(Crashlytics)时

./gradlew crashlyticsUploadDistributionDebug

我收到以下错误:

Configuration ‘compile’ in project ‘:app’ is deprecated. Use
‘implementation’ instead. Configuration ‘testCompile’ in project
‘:app’ is deprecated. Use ‘testImplementation’ instead. The
Task.leftShift(Closure) method has been deprecated and is scheduled to
be removed in Gradle 5.0. Please use Task.doLast(Action) instead.
registerResGeneratingTask is deprecated, use
registerGeneratedFolders(FileCollection) registerResGeneratingTask is
deprecated, use registerGeneratedFolders(FileCollection)
:app:crashlyticsUploadDistributionDebug FAILED

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:app:crashlyticsUploadDistributionDebug’.

    Not valid.

      >尝试:使用–stacktrace选项运行以获取堆栈跟踪.使用–info或–debug选项运行以获取更多日志输出.
      
      
      在1s 1可操作的任务中建立失败:1执行,0避免(0%)

    我不知道,什么“无效”的意思.

    这是我的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
    }
    

    这是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'
    
    }
    

    带有apiSecret的fabric.properties文件也放在项目中.

    编辑:

    手动上传APK到Fabric Beta可以正常运行.

解决方法:

我只是想指出Mike Bonnell的评论,因为它回答了这个问题:

Our command line tools are not compatible with the Alpha version of Gradle 3. We’re looking into the changes that have come with the alpha versions, but we test against betas and stable versions of the releases.

编辑2017/08/25
尝试使用Android Studio 3.0 Beta 3和相应的android gradle插件. gradle任务crashlyticsUploadDistributionDebug似乎再次起作用.

标签:android,crashlytics,kotlin
来源: https://codeday.me/bug/20190828/1752014.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有