Gradle does not have execution permission解決辦法

運行flutter build apk --release 報錯

flutter build apk --release
You are building a fat APK that includes binaries for android-arm, android-arm64, android-x64.
If you are deploying the app to the Play Store, it's recommended to use app bundles or split the APK to
reduce the APK size.
    To generate an app bundle, run:
        flutter build appbundle --target-platform android-arm,android-arm64,android-x64
        Learn more on: https://developer.android.com/guide/app-bundle
    To split the APKs per ABI, run:
        flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi
        Learn more on:
        https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split
Running Gradle task 'assembleRelease'...                                
Running Gradle task 'assembleRelease'... Done                       0.1s
[!] 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.
Gradle task assembleRelease failed with exit code 1

切換到Android目錄下,查看下文件權限:

soft@soft-2 android % ls -all
total 88
drwxrwxr-x  15 soft  staff   480 Mar 24 22:55 .
drwxrwxr-x  18 soft  staff   576 Mar 27 21:31 ..
-rw-rw-r--   1 soft  staff   117 Dec 12 16:27 .gitignore
drwxrwxr-x   6 soft  staff   192 Jan 16 12:38 .gradle
drwxrwxr-x   4 soft  staff   128 Mar 23 10:35 app
-rw-rw-r--   1 soft  staff  1206 Feb  8 19:57 build.gradle
-rw-rw-r--   1 soft  staff  1489 Jan 16 11:56 flutter_exam_android.iml
drwxrwxr-x   3 soft  staff    96 Jan 16 11:55 gradle
-rw-rw-r--   1 soft  staff   108 Jan 16 11:55 gradle.properties
-rw-rw-r--   1 soft  staff  4971 Jan 16 11:55 gradlew
-rw-rw-r--   1 soft  staff  2404 Jan 16 11:55 gradlew.bat
-rw-rw-r--   1 soft  staff  2205 Mar 22 17:41 key.jks
-rw-rw-r--   1 soft  staff   135 Mar 24 22:55 key.properties
-rw-rw-r--   1 soft  staff   145 Mar 24 22:50 local.properties
-rw-rw-r--   1 soft  staff   499 Aug 29  2019 settings.gradle

gradlew沒有執行權限,運行 chmod a+x gradlew 增加執行權限 即可解決問題。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章