Rez*_*eli 1 android crashlytics android-gradle-plugin android-jetpack
好吧,我创建了一个项目,并添加了Fabric插件和Crashlytics依赖项,我也测试了它并且它有效.但是当我重构项目以使用AndroidX并启用jetifier工具时android.enableJetifier=true,项目不会构建,我会遇到多个错误:
Failed to transform file 'crashlytics-2.9.2.aar' to match attributes {artifactType=jetified-aar} using transform JetifyTransform
jetifier工具和Crashlytics依赖性似乎有问题.有没有办法关闭JetifyTransform单个依赖?
项目级gradle文件:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.41'
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.0-alpha14'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.gms:google-services:3.1.2'
classpath 'io.fabric.tools:gradle:1.25.1'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
模块级gradle文件:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'io.fabric'
android {
compileSdkVersion 'android-P'
defaultConfig {
applicationId "ir.scannpay.person"
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.0.0-alpha1'
implementation 'androidx.constraintlayout:constraintlayout:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0-alpha1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha1'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.2'
}
Run Code Online (Sandbox Code Playgroud)
gradle.properties文件:
android.enableJetifier=true
android.useAndroidX=true
Run Code Online (Sandbox Code Playgroud)
而且我没有忘记把Fabric钥匙放进去manifest,我也把google-services.json文件放在app模块中.
当我尝试构建时,我得到了以下多个错误:
Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'crashlytics-2.9.2.aar' to match attributes {artifactType=jetified-aar} using transform JetifyTransform
Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'crashlytics-core-2.6.2.aar' to match attributes {artifactType=jetified-aar} using transform JetifyTransform
Unable to resolve dependency for ':app@debug/compileClasspath': Failed to transform file 'beta-1.2.7.aar' to match attributes {artifactType=jetified-aar} using transform JetifyTransform
Run Code Online (Sandbox Code Playgroud)
好吧,我找到了解决方案.
您需要做的是将结构版本升级到1.25.4项目级build.gradle文件:
buildscript {
dependencies {
classpath 'com.google.gms:google-services:3.2.0'
classpath 'io.fabric.tools:gradle:1.25.4'
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1326 次 |
| 最近记录: |