Flutter项目路径含非ASCII字符构建失败求助
解决Flutter项目构建失败问题
问题现象
Flutter项目构建失败,CMD输出报错信息如下:
Launching lib\main.dart on AOSP on IA Emulator in debug mode... main.dart:1 FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\emott\OneDrive\Masaüstü\myapp\android\app\build.gradle' line: 24 * What went wrong: A problem occurred evaluating project ':app'. Failed to apply plugin 'com.android.internal.application'. Your project path contains non-ASCII characters. This will most likely cause the build to fail on Windows. Please move your project to a different directory. See http://b.android.com/95744 for details. This warning can be disabled by adding the line 'android.overridePathCheck=true' to gradle.properties file in the project directory. * 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 3s Exception: Gradle task assembleDebug failed with exit code 1 Exited (sigterm)
已尝试无效的方案
- GitHub Flutter仓库相关Issue
- Flutter论坛相关讨论帖
- Stack Overflow相关提问帖
有效解决方案
方案1:彻底解决(推荐)
将项目移动到不包含非ASCII字符的路径下,例如把原路径C:\Users\emott\OneDrive\Masaüstü\myapp替换为C:\Users\emott\Projects\myapp这类纯英文路径,之后重新执行构建命令。
方案2:临时绕过限制
在项目根目录的gradle.properties文件中添加以下配置:
android.overridePathCheck=true
保存文件后重新运行Flutter构建命令。
内容的提问来源于stack exchange,提问作者renanuya
相关产品推荐
相关产品推荐

