gpt4 book ai didi

java - AndroidX 喷射器 : Failed to transform file 'android-all-9-robolectric-4913185-2.jar' to match attributes using transform JetifyTransform

转载 作者:太空狗 更新时间:2023-10-29 14:38:06 27 4
gpt4 key购买 nike

迁移到 AndroidX 后,构建 Failed to transform 'C:\Users\User\.gradle\caches\modules-2\files-2.1\org.robolectric\android-all\9 时收到此错误-robolectric-4913185-2\92c6ca3712d7a06f76f70655ec81162ff372fb19\android-all-9-robolectric-4913185-2.jar' 使用 Jetifier。原因:com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:3 字节 UTF-8 序列的字节 2 无效。(使用 --stacktrace 运行以获得更多详细信息。)要禁用 Jetifier,请设置 android .enableJetifier=false 在你的 gradle.properties 文件中。
运行单元测试时。我确实需要将 enableJetifier 设置为 true。

有没有人知道为什么会发生这种情况或如何解决?我只是添加了更多代码以提供更好的洞察力。所有版本都在版本数组中。

gradle.properties:

org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
android.useAndroidX=true
android.enableJetifier=true

版本:

ext.versions = [
androidSupport : '28.0.0',
otto : '1.3.8',
retrofit : '2.4.0',
okhttp3 : '3.11.0',
animator : '2.2.3',
gson : '2.8.5',
joda : '2.9.3',
commonsLang3 : '3.4',
commonsIo : '2.5',
commonsCollections: '3.2.2',
commonsCodec : '1.10',
espresso : '3.1.0-beta01',
hamcrest : '1.3',
junit : '4.12',
mockito : '1.10.19',
powerMock : '1.6.5',
dagger : '2.17',
parcel : '1.1.5',
butterKnife : '9.0.0-SNAPSHOT',

robolectric : '4.0-beta-1',
assertj : '3.11.1',
awaitility : '3.1.2',
material : '1.0.0'
]

构建.gradle:

    dependencies {
implementation 'com.google.android.gms:play-services-auth:16.0.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation('androidx.annotation:annotation:1.0.0') {
force true
}

implementation "com.google.guava:guava:$versions.guava"

implementation "com.google.dagger:dagger:$versions.dagger"
annotationProcessor "com.google.dagger:dagger-compiler:$versions.dagger"

implementation "com.squareup:otto:$versions.otto"
implementation "com.squareup.retrofit2:retrofit:$versions.retrofit"
implementation "com.squareup.retrofit2:converter-gson:$versions.retrofit"
implementation "com.squareup.okhttp3:okhttp:$versions.okhttp3"
implementation "com.google.android.material:material:$versions.material"

implementation "jp.wasabeef:recyclerview-animators:$versions.animator"

implementation "com.google.code.gson:gson:$versions.gson"
implementation "net.danlew:android.joda:$versions.joda"

implementation "org.apache.commons:commons-lang3:$versions.commonsLang3"
implementation "commons-collections:commons-collections:$versions.commonsCollections"
implementation "commons-io:commons-io:$versions.commonsIo"
implementation "commons-codec:commons-codec:$versions.commonsCodec"

implementation "com.squareup.picasso:picasso:$versions.picasso"

implementation "org.parceler:parceler-api:$versions.parcel"
annotationProcessor "org.parceler:parceler:$versions.parcel"

implementation "com.jakewharton:butterknife:$versions.butterKnife"
annotationProcessor "com.jakewharton:butterknife-compiler:$versions.butterKnife"



// test dependencies
testImplementation "junit:junit:$versions.junit"
testImplementation "org.mockito:mockito-core:$versions.mockito"
testImplementation "org.powermock:powermock-core:$versions.powerMock"
testImplementation "org.powermock:powermock-module-junit4:$versions.powerMock"
testImplementation "org.powermock:powermock-module-junit4-rule:$versions.powerMock"
testImplementation "org.powermock:powermock-api-mockito:$versions.powerMock"
testImplementation "org.powermock:powermock-classloading-xstream:$versions.powerMock"
testImplementation "org.hamcrest:hamcrest-core:$versions.hamcrest"
testImplementation "org.hamcrest:hamcrest-library:$versions.hamcrest"
testImplementation "org.robolectric:robolectric:$versions.robolectric"
testImplementation "org.assertj:assertj-core:$versions.assertj"
testImplementation "org.robolectric:android-all:9-robolectric-4913185-2"

// android test dependencies
androidTestImplementation 'androidx.test:runner:1.1.0-beta01'
androidTestImplementation 'androidx.test:rules:1.1.0-beta01'
androidTestImplementation "junit:junit:$versions.junit"
androidTestImplementation "org.mockito:mockito-core:$versions.mockito"
androidTestImplementation "org.hamcrest:hamcrest-core:$versions.hamcrest"
androidTestImplementation "org.hamcrest:hamcrest-library:$versions.hamcrest"
androidTestImplementation "com.squareup.retrofit2:retrofit-mock:$versions.retrofit"
androidTestImplementation "com.google.guava:guava:$versions.guava"
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
androidTestImplementation("androidx.test.espresso:espresso-contrib:$versions.espresso", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation("androidx.test.espresso:espresso-intents:$versions.espresso", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation("androidx.test.espresso:espresso-core:$versions.espresso", {
exclude group: 'com.android.support', module: 'support-annotations'
})
androidTestImplementation "com.google.dagger:dagger:$versions.dagger"
androidTestAnnotationProcessor "com.google.dagger:dagger-compiler:$versions.dagger"
androidTestImplementation 'androidx.multidex:multidex:2.0.0'
androidTestImplementation "org.awaitility:awaitility:$versions.awaitility"
}

最佳答案

这可能是 Jetifier 的一个错误。尝试将此添加到您的项目 gradle:

buildscript {
dependencies {
classpath 'com.android.tools.build.jetifier:jetifier-processor:1.0.0-beta02'
}
}

如果您正在使用数据绑定(bind),您可能需要将其添加到您的应用程序 gradle 依赖项中:

annotationProcessor 'com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02'

如果你使用的是 kotlin,那么你需要这两个

kapt 'com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02'
annotationProcessor 'com.android.tools.build.jetifier:jetifier-core:1.0.0-beta02'

关于java - AndroidX 喷射器 : Failed to transform file 'android-all-9-robolectric-4913185-2.jar' to match attributes using transform JetifyTransform,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52738428/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com