gpt4 book ai didi

android - transformClassesWithDesugarForDebug 出错

转载 作者:太空宇宙 更新时间:2023-11-03 13:43:59 25 4
gpt4 key购买 nike

我在编译 APK(调试或发布)时遇到问题。

Android Studio 3.0 测试版 5

这是我的build.gradle(应用)

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}

repositories {
maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.android.application'
apply plugin: 'io.fabric'

android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.my.package"
minSdkVersion 15
targetSdkVersion 26
final MAJOR_RELEASE = 0
final MINOR_RELEASE = 29
versionCode getVersionCodeNumber(MAJOR_RELEASE, MINOR_RELEASE)
versionName getVersionCodeName(MAJOR_RELEASE, MINOR_RELEASE)
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
proguardFiles fileTree(dir: 'proguard', include: ['*.pro']).asList().toArray()
}

signingConfigs {
omitted
}

buildTypes {
release {
debuggable false
minifyEnabled false
shrinkResources false
signingConfig signingConfigs.releaseConfig
}
debug {
debuggable true
minifyEnabled false
shrinkResources false
versionNameSuffix '-DEBUG'
signingConfig signingConfigs.debugConfig
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
dexOptions {
javaMaxHeapSize "4g"
}
}

afterEvaluate {
assembleRelease.dependsOn testReleaseUnitTest
}

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

//Testing
testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.10.19'

androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support:support-annotations:26.0.2'

implementation 'com.dadino.quickstart:core:0.3.11'

//Support
implementation 'com.android.support:support-v4:26.0.2'
implementation 'com.android.support:design:26.0.2'
implementation 'com.android.support:recyclerview-v7:26.0.2'
implementation 'com.android.support:palette-v7:26.0.2'
implementation 'com.android.support:cardview-v7:26.0.2'
implementation 'com.android.support:support-v13:26.0.2'
implementation 'com.android.support:appcompat-v7:26.0.2'
implementation 'com.android.support:customtabs:26.0.2'

//Square
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
implementation 'com.squareup.retrofit2:adapter-rxjava:2.3.0'
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
implementation 'com.squareup.okhttp3:okhttp:3.8.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'
implementation 'com.squareup.picasso:picasso:2.5.2'

debugImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
releaseImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
testImplementation 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'

//Google
compile 'com.google.android.gms:play-services-gcm:10.2.1'
compile 'com.google.android.gms:play-services-vision:10.2.1'
compile 'com.google.android.gms:play-services-location:10.2.1'

//Firebase
compile 'com.google.firebase:firebase-core:10.2.1'
compile 'com.google.firebase:firebase-config:10.2.1'
compile 'com.google.firebase:firebase-messaging:10.2.1'

//Requery
implementation 'io.requery:requery:1.0.1'
implementation 'io.requery:requery-android:1.0.1'
annotationProcessor 'io.requery:requery-processor:1.0.1'

//RxJava
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.3.0'
implementation 'io.reactivex:rxjava-math:1.0.0'
implementation 'com.artemzin.rxjava:proguard-rules:1.3.0.0'
implementation 'com.jakewharton.rxbinding:rxbinding:1.0.1'
implementation 'com.jakewharton.rxrelay:rxrelay:1.2.0'
implementation 'pl.charmas.android:android-reactive-location:0.10@aar'

//UI
implementation 'com.github.rahatarmanahmed:circularprogressview:2.5.0'
implementation 'com.wdullaer:materialdatetimepicker:3.0.0'

implementation('com.crashlytics.sdk.android:crashlytics:2.6.5@aar') {
transitive = true
}
}


def getVersionCodeName(int major, int minor) {
def versionCodeName = major * 100 + minor
return "${versionCodeName}"
}

def getVersionCodeNumber(int major, int minor) {
def versionCodeName = major * 100 + minor
return versionCodeName
}




configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
def requested = details.requested
if (requested.group == 'com.android.support') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '26.0.2'
}
}

if (requested.group == 'com.google.firebase' || requested.group == 'com.google.android.gms') {
if (!requested.name.startsWith("multidex")) {
details.useVersion '11.2.2'
}
}
}

resolutionStrategy {
force 'com.google.code.gson:gson:2.8.1'
}
}

apply plugin: 'com.google.gms.google-services'

这是我的build.gradle(项目)

buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta5'
classpath 'com.google.gms:google-services:3.0.0'
}
}

allprojects {
repositories {
maven { url "https://jitpack.io" }
maven {
url "http://dl.bintray.com/dadino/quickstart"
}
jcenter()
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

这是我在编译时遇到的错误

Information:Gradle tasks [:app:assembleDebug]
Error:java.lang.ClassNotFoundException: Class io.reactivex.Observable not found
Error:Execution failed for task ':app:transformClassesWithDesugarForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException:
Error while executing java process with main class com.google.devtools.build.android.desugar.Desugar with arguments
{--input /Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --output
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/desugar/debug/0 --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/classes/debug --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/0.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/1.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/2.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/3.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/4.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/5.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/6.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/7.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/8.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/9.jar --classpath_entry
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/10.jar --classpath_entry
*all the same to 58.jar*
/Users/davidcorsalini/Documents/AndroidStudioProjects/controllori/app/build/intermediates/transforms/stackFramesFixer/debug/59.jar --bootclasspath_entry
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/android.jar --bootclasspath_entry
/Users/davidcorsalini/Library/Android/sdk/platforms/android-26/optional/org.apache.http.legacy.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/resources.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/rt.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jsse.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/jce.jar --bootclasspath_entry
/Applications/Android Studio 3.0 Preview.app/Contents/jre/jdk/Contents/Home/jre/lib/charsets.jar --min_sdk_version 15 --desugar_try_with_resources_if_needed --desugar_try_with_resources_omit_runtime_classes}
Information:BUILD FAILED in 2s
Information:2 errors
Information:0 warnings
Information:See complete output in console

我已经搜索并阅读了所有关于 desugar 错误的页面,但我找不到我的项目有什么问题。我也不明白为什么他在寻找 io.reactivex.Observable 有时是 io.reactivex.Flowable,而我正在使用 RxJava1 ,而不是 RxJava2

最佳答案

在 gradle.properties 文件中添加 android.enableD8.desugaring = true

关于android - transformClassesWithDesugarForDebug 出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46201268/

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