我开始使用新的更新 Android Studio 4.0.0 并遵循在 D8 和 R8 中启用支持 java 8 库的脱糖:
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
Run Code Online (Sandbox Code Playgroud)
和
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.0.6'
...
}
Run Code Online (Sandbox Code Playgroud)
我最终无法构建我的应用程序,并出现以下错误:
Unsupported desugared library configuration version, please upgrade the D8/R8 compiler.
Run Code Online (Sandbox Code Playgroud)
更多信息:
> Task :app:compileNoExtensionsDebugSources UP-TO-DATE
> Transform artifact desugar_jdk_libs_configuration-0.12.0.jar (com.android.tools:desugar_jdk_libs_configuration:0.12.0) with L8DexDesugarLibTransform
Error: Unsupported desugared library …Run Code Online (Sandbox Code Playgroud) 以下是我的配置.这适用于Android Lollipop但在Android Kitkat上崩溃.
我尝试了每个解决方法,但无法帮助:
错误膨胀类android.support.design.widget.NavigationView
的build.gradle
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
minSdkVersion 14
targetSdkVersion 23
// Support RenderScript Library v8
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
}
}
ext{
supportLibVersion = '23.1.1'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.android.support:design:${supportLibVersion}"
compile "com.android.support:cardview-v7:${supportLibVersion}"
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
}
Run Code Online (Sandbox Code Playgroud)
主题 style.xml
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" parent="AppTheme">
<item name="windowActionBar">false</item> …Run Code Online (Sandbox Code Playgroud) android android-support-library navigation-drawer navigationview android-support-design