1、What went wrong: Execution failed for task ':fluwx:compileDebugKotlin'.
* What went wrong:
Execution failed for task ':fluwx:compileDebugKotlin'.
> Compilation error. See log for more details
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
官方Github issues 咱们修改一下Kotlin版本号即可
修改:android-->build.gradle
buildscript { ext.kotlin_version = '1.4.10'//修改为1.4.10或者1.4.20 都可以 repositories { google() mavenCentral() } dependencies { classpath 'com.android.tools.build:gradle:4.1.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" }}
2、D8: Cannot fit requested classes in a single dex file
* What went wrong:
Execution failed for task ':app:mergeDexDebug'.
> A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives:
The number of method references in a .dex file cannot exceed 64K.
Learn how to resolve this issue at https://developer.android.com/tools/building/multidex.html
修改:android -->app-->build.gradle
A) 更改最小目标 SDK
-
打开android/app/build.gradle,然后找到显示minSdkVersion 16.
-
修改minSdkVersion 16 为 minSdkVersion 21
B)如果你想支持旧的 Android 版本,你可以使用 multidex 支持库
-
打开并修改project/app/build.gradle文件以启用 multidex 并将 multidex 库添加为依赖项
-
android { defaultConfig { ... multiDexEnabled true } ... } dependencies { implementation 'com.android.support:multidex:1.0.3' }