使用transformClassesWithDexBuilderForDebug为进程okhttp-3.13.1.jar构建Android离子源失败

问题描述 投票:0回答:1

在更新android studio后尝试在离子2中构建一个android平台时,这个错误开始显现。

  Ionic Info:

   ionic (Ionic CLI)  : 4.3.0 (/usr/local/lib/node_modules/ionic)
   Ionic Framework    : ionic-angular 3.9.2
   @ionic/app-scripts : 3.1.9

Cordova:

   cordova (Cordova CLI) : 8.1.2 ([email protected])
   Cordova Platforms     : android 6.4.0
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 1.2.1, (and 15 other plugins)

System:

   NodeJS : v8.12.0 (/usr/local/bin/node)
   npm    : 6.4.1
   OS     : macOS Sierra
   Xcode  : Xcode 8.3.2 Build version 8E2002

FAILURE:构建因异常而失败。

What went wrong:
Execution failed for task ’:transformClassesWithDexBuilderForDebug’. >

com.android.build.api.transform.TransformException:com.android.builder.dexing.DexArchiveBuilderException:com.android.builder.dexing.DexArchiveBuilderException:

Failed to process /.gradle/caches/modules-2/files-2.1/com.squareup.okhttp3/okhttp/3.13.1/b49cf3799bd473199e96c4fb9987e9e08395a1c0/okhttp-3.13.1.jar

发现Dexbuilder错误与Java版本8有关。

java android ionic-framework ionic2
1个回答
1
投票

在/ platforms / android文件夹中的“Build.Gradle”文件中修改这些选项解决了这个问题

compileOptions {
   sourceCompatibility JavaVersion.VERSION_1_8
   targetCompatibility JavaVersion.VERSION_1_8
}
© www.soinside.com 2019 - 2024. All rights reserved.