首页 > 解决方案 > 尝试为颤振应用程序生成 APK,但以下错误不断出现

问题描述

尝试为颤振应用程序构建 android APK 并且这些错误不断出现

FAILURE: Build failed with an exception.



* What went wrong:

Execution failed for task ':app:transformClassesAndResourcesWithR8ForRelease'.

> com.android.tools.r8.CompilationFailedException: Compilation failed to complete



* 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



BUILD FAILED in 22m 24s
Running Gradle task 'assembleRelease'...                         1358.6s (!)
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin agora_rtc_engine...
Running Gradle task 'assembleAarRelease'...                      1096.7s (!)
Downloading https://services.gradle.org/distributions/gradle-4.6-all.zip

........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'agora_rtc_engine'.
Unzipping C:\Users\me\.gradle\wrapper\dists\gradle-4.6-all\bcst21l2brirad8k2ben1letg\gradle-4.6-all.zip to C:\Users\me\.gradle\wrapper\dists\gradle-4.6-all\bcst21l2brirad8k2ben1letg
> SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details

WARNING: The option setting 'android.enableR8=true' is experimental and unsupported.
* Try:
The current default is 'false'
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.
Consider disabling R8 by removing 'android.enableR8=true' from your gradle.properties before publishing your app.


* Get more help at https://help.gradle.org

BUILD FAILED in 18m 12s

The plugin agora_rtc_engine could not be built due to the issue above.

当我运行代码时,它工作正常。所以我假设问题不在于代码。那么可能是什么问题导致它无法构建 apk

正式的 sdk 目录是这样的,sdk.dir=C:\\Users\\me\\AppData\\Local\\Android\\Sdk但后来我通过在“C”前面包含“\”将其更改为下面的内容,Flutter 构建 APK 没有响应

这是我的local.properties

sdk.dir=C\:\\Users\\me\\AppData\\Local\\Android\\Sdk
flutter.sdk=C\:\\src\\flutter
flutter.buildMode=release
flutter.versionName=1.0.0
flutter.versionCode=1

这是我的settings.gradle

include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
    pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}

plugins.each { name, path ->
    def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
    include ":$name"
    project(":$name").projectDir = pluginDirectory
}

现在,当我单击构建 APK 时,Android 工作室没有响应(即尝试构建 APK),当它尝试构建 APK 时,它会带来这些错误,我检查了与此类似的问题并尝试了解决方案,sdk.dir但该错误仍未修复

标签: androidfluttergradledart

解决方案


推荐阅读