首页 > 解决方案 > com.google.android.material:material:1.1.0-alpha08 fails but 1.0.0 works fine

问题描述

I am looking into the new android material stuff and it looks fine but in order to properly utilise the colour options I need to use com.google.android.material:material:1.1.0 (the latest of which is alpha08) clearly there is a dependency issue because when I build in android studio it says all ok but when I run it is is missing

 android material com.android.builder.dexing.DexArchiveBuilderException

at run time (like this).

enter image description here

this is my app.build.gradle

dependencies {
    implementation 'androidx.core:core:1.0.2'
    implementation 'androidx.media:media:1.0.1'
    implementation 'androidx.legacy:legacy-support-v4:1.0.0'
    implementation 'androidx.appcompat:appcompat:1.0.2'
    implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
    implementation 'io.reactivex.rxjava2:rxjava:2.2.10'
    implementation 'com.google.android.material:material:1.0.0' // fails if I switch to implementation 'com.google.android.material:material:1.1.0-alpha08'
    api 'com.google.guava:guava:28.0-android'
    implementation files('libs/acra-4.5.0.jar')
    implementation files('libs/commons-collections-3.2.1.jar')
    implementation 'com.google.firebase:firebase-core:17.0.1'
    implementation 'com.google.firebase:firebase-messaging:19.0.1'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.exifinterface:exifinterface:1.0.0'
}

as far as I can tell everything us in tip top shape so what is the issue do you think?

标签: javaandroidandroid-studiogradle

解决方案


我发现这是原因,将其添加到build.gradle [Module.app]文件中

android {

   [.YOUR.OTHER.STUFF.HERE.]

   compileOptions {
      sourceCompatibility JavaVersion.VERSION_1_8
      targetCompatibility JavaVersion.VERSION_1_8
   } 
}

推荐阅读