简体   繁体   English

运行没有权限的 flutter 项目时出错

[英]Error in running flutter project which no permission

Launching lib/main.dart on Android SDK built for x86 in debug mode...在 Android SDK 上启动 lib/main.dart 在D调试模式...

[.] Gradle does not have execution permission, You should change the ownership of the project directory to your user. [.] Gradle 没有执行权限,您应该将项目目录的所有权更改为您的用户。 or move the project to a directory with execute permissions.或将项目移动到具有执行权限的目录。 Gradle task assembleDebug failed with exit code 1 Exited (sigterm) Gradle 任务 assembleDebug 失败,退出代码 1 退出 (sigterm)

I got the same error trying to execute flutter run on a mac.尝试在 Mac 上flutter run了同样的错误。 Apparently, in your flutter project, there is a file android/gradlew that is expected to be executable (and it wasn't).显然,在您的 flutter 项目中,有一个文件android/gradlew预计是可执行的(但它不是)。 So in my case, I ran...所以在我的情况下,我跑了......

chmod a+rx android/gradlew

...afterwards the flutter command worked. ...之后flutter命令起作用了。

Try to set the execution flag on your gradlew file:尝试在您的 gradlew 文件上设置执行标志:

chmod +x gradlew

FOR FLUTTER I have tried mostly everything mentioned here and on my own.对于 FLUTTER ,我已经尝试了这里提到的所有内容,并且我自己也尝试了。 The solution, actually, it is a series of solutions and worked for me, I am mentioning them try as you wish.解决方案,实际上,它是一系列解决方案并且对我有用,我提到他们可以随心所欲地尝试。

  1. Make sure no antivirus *firewall is blocking, gradle.bat, gradlew.bat, git, flutter, android studio确保没有防病毒软件*防火墙被阻止,gradle.bat, gradlew.bat, git, flutter, ZC31B3236417CE19CA8Z studio15CE5DA

  2. Get the latest Gradle and install it to lower privilege directory, not in Program Files or Program Files (X86);获取最新的 Gradle 并将其安装到较低权限的目录,而不是在 Program Files 或 Program Files (X86) 中; I did it in D drive.我是在D盘做的。 Don't forget to update the path in Environment Variables.不要忘记更新环境变量中的路径。

  3. I also installed JAVA Runtime (JRE).我还安装了 JAVA 运行时(JRE)。

  4. Install git as it is necessary for flutter.根据 flutter 的需要,安装 git。

  5. You can Check-in windows command line after installing each (Git, Gradle and flutter doctor).您可以在安装每个(Git、Gradle 和 flutter 博士)后签入 windows 命令行。 if nothing seems to work Restart the pc after each.如果似乎没有任何效果,请在每次之后重新启动电脑。


  1. You might try it first, Disable the Gradle plugin and re-enable and restart android studio.您可以先尝试一下,禁用 Gradle 插件并重新启用并重新启动 android studio。

After this when you will compile /run the app it will take a long time please bear with that(at least 15 min just to be sure).在此之后,当您编译/运行应用程序时,将需要很长时间,请耐心等待(至少 15 分钟以确保)。


I had the app directory with Read, Write & Modifying permissions still, it was giving that error- Error code 1 "gradle does not have execution permission. you should change the ownership of the project directory to your user, or move the project to a directory with execute permissions."我仍然拥有具有读取,写入和修改权限的应用程序目录,它给出了错误- 错误代码 1“gradle 没有执行权限。您应该将项目目录的所有权更改为您的用户,或将项目移动到具有执行权限的目录。”

so I think it is related to the connection with the plugin.所以我认为这与与插件的连接有关。

Hope it helped:-)希望它有所帮助:-)

chmod a+rx android/gradlew

This works but for windows you need to install "Git for Windows"这有效,但对于 windows,您需要安装“Git for Windows”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 运行我的 flutter 项目时出错:Scaffold.maybeOf(context)? - Error running my flutter project : Scaffold.maybeOf(context)? 在Android Studio中运行Flutter项目时发生Gradle错误 - Gradle Error while running flutter project in Android Studio 运行 flutter 后清理项目抛出 gradle 错误 - After running flutter clean the project throwing gradle error 哪个权限用于共享首选项? 安卓(颤振) - Which permission to use for shared preferences? android(flutter) 第一次运行Flutter项目 - first time running Flutter Project 构建第一个 flutter 项目并在外部设备上运行时出错,出现错误“Gradle task assembleDebug failed with exit code 1” - Error while building the first flutter project and running it on external device with error “Gradle task assembleDebug failed with exit code 1” 为什么在 Android 设备中运行项目时会发生与 firebase 相关的 flutter 错误? - Why is this firebase related error in flutter happen while running project in android device? 将 flutter 应用程序运行到真实设备时出现权限问题 - Getting Permission issue while running flutter app to real device Android Studio 在运行 Flutter 项目时出现问题 - Problem with Android Studio in running Flutter project 运行 flutter 应用程序时出错 - Getting an error on running flutter application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM