【问题标题】:A problem occurred evaluating project ':app'. > path may not be null or empty string. path='null'评估项目 ':app' 时出现问题。 > 路径不能为 null 或空字符串。路径='空'
【发布时间】:2019-06-24 17:12:37
【问题描述】:

我在尝试运行 Flutter 时遇到错误。

 D:\fluttapp\testbuild>flutter run
Launching lib/main.dart on Google Pixel 2 XL in debug mode...
Initializing gradle...                                       2.1s
Resolving dependencies...
* Error running Gradle:
ProcessException: Process "D:\fluttapp\testbuild\android\gradlew.bat" exited abnormally:

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\fluttapp\testbuild\android\app\build.gradle' line: 57

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path='null'

* 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 6s
  Command: D:\fluttapp\testbuild\android\gradlew.bat app:properties


Please review your Gradle project setup in the android/ folder.

D:\fluttapp\testbuild>flutter doctor -v
[√] Flutter (Channel beta, v1.1.8, on Microsoft Windows [Version 10.0.17134.556], locale
    en-IN)
    • Flutter version 1.1.8 at D:\flutter
    • Framework revision 985ccb6d14 (3 weeks ago), 2019-01-08 13:45:55 -0800
    • Engine revision 7112b72cc2
    • Dart version 2.1.1 (build 2.1.1-dev.0.1 ec86471ccc)

[√] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at D:\Users\Bhanu\AppData\Local
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • ANDROID_HOME = D:\Users\Bhanu\AppData\Local
    • Java binary at: D:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)
    • All Android licenses accepted.

[√] Android Studio (version 3.1)
    • Android Studio at D:\Program Files\Android\Android Studio
    • Flutter plugin version 29.0.1
    • Dart plugin version 173.4700
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1024-b02)

[√] Connected device (1 available)
    • Google Pixel 2 XL • 192.168.50.101:5555 • android-x86 • Android 9 (API 28)

• No issues found!

我在这里添加了回购。我已经使用示例代码来制作发布应用程序版本,但无法生成它们。创建密钥库并添加到代码仓库

https://github.com/bhanu888/buildapk

【问题讨论】:

标签: gradle flutter keystore android-keystore


【解决方案1】:

对我来说,这是一个路径问题。

我一直在关注颤振指南https://flutter.io/docs/deployment/android

Create a file named <app dir>/android/key.properties that contains a reference to your keystore:

出于某种原因,我(错误地)将我的“key.properties”放在了 app_dir/android/app 文件夹中,这给了我错误。

* What went wrong:
A problem occurred evaluating project ':app'.
> path may not be null or empty string. path='null'

所以请检查您的路径,以及您的文件所在的位置 :)

奖励信息: 帮助 med 的是检查具有不同设置的“gradle.build”文件,它总是给我带来问题的 storeFile 文件(keystoreProperties ['storeFile'])。 尝试将其注释掉,或将其更改为:

storeFile file("key.jks")  

如果这可行,您就知道“key.jks”文件的路径正确。然后尝试引入poperties文件(keystoreProperties) 喜欢

storeFile file(keystoreProperties['storeFile']) 

起初这不起作用,但现在可以了:)

所以再次检查您的“key.jks”和“key.properties”文件是否位于“正确”的位置,以及您指向它们的方式。

【讨论】:

  • 这真的解决了这个问题吗?听起来您只是在描述您遇到的问题以及如何解决它。
  • 我希望如此,但我不知道,我们只能知道 op 何时返回。 .它解决了我的问题,看起来与 OP 相同。操作描述的错误屏幕和过程与我所经历的相同。并且修复提供了正确的路径:)
  • 我做了你的修复,但仍然有这个问题。 null 和 null 无处不在。告诉我,什么是正确的路径? ex /Users/smth/key.jks 但我应该引用它吗?是路径的unix语法还是windows?
  • 我的 keystore.jks 文件位于“FlutterApp/android/app/keystore.jks”。在“FlutterApp/android/app/build.gradle”旁边。请注意,flutter 项目中有两个 build.gradle 文件。
【解决方案2】:

如果您从 github 下载了该应用程序,则签名配置可能已适应注释。尝试像这样在 android/app/build.gradle 上评论代码:

    /*signingConfigs {
    release {
  keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        storeFile file(keystoreProperties['storeFile'])
        storePassword keystoreProperties['storePassword']
    }
}
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.release
    }
   */`

解决方案在: https://github.com/transistorsoft/flutter_background_geolocation/issues/18

【讨论】:

    【解决方案3】:

    我用过

    storeFile file(keystoreProperties['storeFile'])
    

    在编译时抛出了一个错误。但是将上面的行替换为

    storeFile file("key.jks")
    

    构建成功。我不知道这是怎么回事..?

    【讨论】:

    • 如果您想知道一些事情,那么您发布一个问题,如果您想展示如何解决问题,您发布一个答案。您想将此作为解决方案(删除带问号的短语)还是想要一个答案(然后提出一个新问题)?
    • 他们所说的解决方案在将代码行更改为'storeFile file("key.jks")'后导致构建错误,构建成功。我只想给出两种解决方案所暗示的答案,无论它们的工作方法如何
    • 我想知道在哪里粘贴密钥文件以便它可以运行
    【解决方案4】:

    如果您只是测试或调试而不是发布,您可以考虑将构建类型更改为调试而不是发布。

    In <APP_FOLDER>/android/app/build.gradle
    
    buildTypes {
            release {
                signingConfig signingConfigs.debug
           }
        }
    

    【讨论】:

      【解决方案5】:

      1)查看本项目中的Key“key.jks”

      转到“gradle.build”

      替换它

      storeFile file("key.jks")  
      

      storeFile file(keystoreProperties['storeFile']) 
      

      【讨论】:

        【解决方案6】:

        必须有2个后缀的文件

        1. “调试”
        2. “发布” 通过文件资源管理器将这两个文件添加到您的项目中 然后在你的文件中编辑名为 local.properties 的路径
        3. debugStoreFile=C:/Users/Sachin/Android_Studio_project...
        4. storeFile=C:/Users/Sachin/Android_Studio_project...

        【讨论】:

          猜你喜欢
          • 2018-01-05
          • 2017-03-15
          • 2020-08-11
          • 1970-01-01
          • 2021-06-26
          • 2020-03-24
          • 1970-01-01
          • 2019-03-30
          • 1970-01-01
          相关资源
          最近更新 更多