作者:mobiledu2502868653 | 来源:互联网 | 2023-02-02 15:57
我用Android Studio Preview 3.0(Canary 2)创建了一个项目来开始Kotlin开发.我使用Android Studio Fabric插件为我的项目设置Fabric.
但是,当我想使用以下命令将我的应用程序的测试版上传到Fabric Beta(Crashlytics)时
./gradlew crashlyticsUploadDistributionDebug
我收到以下错误:
项目':app'中的配置'compile'已弃用.请改用"实施".项目':app'中的配置'testCompile'已弃用.请改用"testImplementation".不推荐使用Task.leftShift(Closure)方法,并计划在Gradle 5.0中删除它.请改用Task.doLast(Action).不推荐使用registerResGeneratingTask,不推荐使用registerGeneratedFolders(FileCollection)registerResGeneratingTask,使用registerGeneratedFolders(FileCollection):app:crashlyticsUploadDistributionDebug FAILED
FAILURE:构建因异常而失败.
出了什么问题:任务执行失败':app:crashlyticsUploadDistributionDebug'.
无效.
尝试:使用--stacktrace选项运行以获取堆栈跟踪.使用--info或--debug选项运行以获取更多日志输出.
在1s 1可操作的任务中建立失败:1执行,0避免(0%)
我不知道,什么"无效"的意思.
这是我的根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
}
这是应用程序 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'
}
fabric.properties
带有apiSecret 的文件也放在项目中.
编辑:
手动上传APK到Fabric Beta可以正常运行.
1> Christopher..:
我只是想指出Mike Bonnell的评论,因为它回答了这个问题:
我们的命令行工具与Gradle 3的Alpha版本不兼容.我们正在研究alpha版本带来的变化,但我们测试了版本的beta和稳定版本.
编辑2017/08/25
尝试使用Android Studio 3.0 Beta 3和相应的android gradle插件.gradle任务crashlyticsUploadDistributionDebug
似乎再次起作用.