【问题标题】:Flutter: Execution failed for task ':app:packageDebug'Flutter:任务“:app:packageDebug”执行失败
【发布时间】:2019-06-09 16:21:34
【问题描述】:

您好,我在使用 Flutter 编译时遇到问题

我已经尝试使用flutter run进行调试——调试但没有成功 我认为这是从 gradle 开始的,但我不知道如何解决这个问题。

    Resolving dependencies...                                           
    3,5s

    FAILURE: Build failed with an exception.

    * What went wrong:
    Execution failed for task ':app:packageDebug'.
    > Failed to generate v1 signature

    * 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 4s
    Running Gradle task 'assembleDebug'...
    Running Gradle task 'assembleDebug'... Done                         
    5,2s
    Gradle task assembleDebug failed with exit code 1

当我运行颤振医生时:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, v1.7.4-pre.27, on Microsoft Windows [version 
10.0.17763.503], locale fr-FR)

[√] Android toolchain - develop for Android devices (Android SDK version 
28.0.3)
[!] Visual Studio - develop for Windows (Visual Studio Community 2017 
15.9.12)
X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
    MSBuild
    VC++ 2017 version 15.9 v14.16 latest v141 tools
    Windows 10 SDK (10.0.17763.0)
  [√] Android Studio (version 3.4)
  [√] VS Code (version 1.35.0)
  [√] Connected device (1 available)

  ! Doctor found issues in 1 category.

请帮帮我 感谢您的时间和关注。

【问题讨论】:

    标签: android gradle flutter dart


    【解决方案1】:

    在终端运行 flutter clean 并再次运行

    【讨论】:

      【解决方案2】:

      删除这个文件:~/.android/debug.keystore

      【讨论】:

        【解决方案3】:

        对我来说,我可以通过注释 android/app/build.gradle 文件中的发布代码来运行应用程序

        //      signingConfigs {
        //        release {
        //            keyAlias keystoreProperties['keyAlias']
        //            keyPassword keystoreProperties['keyPassword']
        //            storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null
        //            storePassword keystoreProperties['storePassword']
        //        }
        //    }
        //    buildTypes {
        //        release {
        //            minifyEnabled true 
        //             shrinkResources true
        //            signingConfig signingConfigs.release
        //        }
        //    }
        

        取消注释:

        //Debug
            buildTypes {
                release {
                    // TODO: Add your own signing config for the release build.
                    // Signing with the debug keys for now, so `flutter run --release` works.
                    signingConfig signingConfigs.debug
                }
            }
            //Debug
        

        【讨论】:

          【解决方案4】:

          这对我有用

          1. 运行flutter clean
          2. 使用flutter pub get获取包
          3. 再次运行

          【讨论】:

            【解决方案5】:

            解决方案 1

            1. 运行flutter clean
            2. flutter pub get获取所有依赖

            解决方案 2

            添加多索引

            android {
            defaultConfig {
                ...
                minSdkVersion 15 
                targetSdkVersion 28
                multiDexEnabled true
            }
            ...
            
            
            dependencies {
               implementation "androidx.multidex:multidex:2.0.1"
            }
            

            解决方案 3

            删除android sdk中的~/.android/debug.keystore。

            注意:循序渐进,如果以上两个都行不通,请尝试解决方案 3。

            【讨论】:

            • 这些都不起作用:(
            猜你喜欢
            • 2016-06-03
            • 1970-01-01
            • 2015-05-13
            • 2016-07-29
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2019-12-05
            • 2021-02-06
            相关资源
            最近更新 更多