尝试构建Flutter APK并遇到错误问题

时间:2020-04-11 10:52:41

标签: android-studio flutter gradle dart

尝试为Flutter应用构建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”前面加上“ \”将其更改为下面的内容。当我介绍该更改并尝试构建APK Flutter构建APK没有响应(即Flutter无法构建任何APK)。请问出什么问题了,当我尝试在不做任何更改的情况下构建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
}

0 个答案:

没有答案