gradle 评估项目“:app”时出现问题,>path不能为null或空字符串,path='null'

olhwl3o2  于 2023-01-17  发布在  其他
关注(0)|答案(9)|浏览(371)

我面临的错误,而我试图运行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

0g0grzrc

0g0grzrc1#

对我来说,这是一个路径问题。
我遵循了房扑指南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'

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

**额外信息:**帮助我检查“gradle.build“文件的不同设置,总是storeFile文件(keystoreProperties ['storeFile'])给我带来问题。尝试将其注解掉,或将其更改为:

storeFile file("key.jks")

如果这个方法有效,你就知道你的“key.jks”文件的路径是正确的,然后尝试引入属性文件(keystoreProperties)Like

storeFile file(keystoreProperties['storeFile'])

这一开始不起作用,但现在起作用了:)
因此,再次检查“key.jks”和“key.properties“文件是否位于“正确”的位置,以及如何指向它们。

wz1wpwve

wz1wpwve2#

如果您是从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

oxiaedzo

oxiaedzo3#

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

In <APP_FOLDER>/android/app/build.gradle

buildTypes {
        release {
            signingConfig signingConfigs.debug
       }
    }
rbpvctlc

rbpvctlc4#

我已经用了

storeFile file(keystoreProperties['storeFile'])

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

storeFile file("key.jks")

构建是成功的。但我不知道这是怎么发生的。

cyej8jka

cyej8jka5#

The problem occurred when you download an app from github  

go to > android > app > build.gradle

in your build gradle file :--
signingConfigs {
release {
    keyAlias keystoreProperties['keyAlias']
    keyPassword keystoreProperties['keyPassword']
    storeFile file(keystoreProperties['storeFile'])
    storePassword keystoreProperties['storePassword']
}

}

Replace:      storeFile file(keystoreProperties['storeFile'])
to:  storeFile file("key.jks")
0sgqnhkj

0sgqnhkj6#

1)检查本项目中的密钥“key.jks”
请访问“gradle.build“
并将其替换

storeFile file("key.jks")

storeFile file(keystoreProperties['storeFile'])
dgenwo3n

dgenwo3n7#

必须有2个文件,其中一个带有后缀
1.“调试”
1.“release”通过文件资源管理器将这两个文件添加到项目中,然后编辑文件中的路径,即local.properties
1.调试存储文件=C:/用户/Sachin/Android Studio 项目...

  1. storeFile=C:/用户/萨钦/Android Studio 项目...
ruoxqz4g

ruoxqz4g8#

删除或评论后对我有效
这些行(与应用密钥签名相关)来自“build.gradle”文件

//android.signingConfigs.release.storeFile rootProject.file(props.keyStore)
//android.signingConfigs.release.storePassword props.keyStorePassword
//android.signingConfigs.release.keyAlias props.keyAlias
//android.signingConfigs.release.keyPassword props.keyAliasPassword
qf9go6mv

qf9go6mv9#

这对我很有效
更换:storeFile file(keystoreProperties['storeFile'])
至:storeFile file("key.jks")

相关问题