A problem occurred evaluating project ':app'. > path may not be null or empty string. path='null'
Asked Answered
T

10

35

Iam facing error while iam trying to run 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!

I have add repo here. I have taken sample code to make release app version but unable to generate them. Key store is created and add to code repo

https://github.com/bhanu888/buildapk

Toilet answered 31/1, 2019 at 9:26 Comment(3)
For anyone looking into this github.com/flutter/flutter/issues/27306 has a few additional information (like gradle file with signingConfigs)Gravestone
having same issue! when i want to release the apkSalol
had this issue. Flutter clean did the jobWhitehot
L
32

For me it was a pathing problem.

I was following the flutter guide https://flutter.io/docs/deployment/android

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

For some reason I (wrongfully) placed my "key.properties" in the app_dir/android/app folder, and this gave me the error.

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

So check your pathing, and where your files are located :)

Bonus info: What helped med was checking the "gradle.build" file with different settings, and it was always the storeFile file(keystoreProperties['storeFile']) that gave me problems. Try commenting it out, or change it to:

storeFile file("key.jks")  

If this works, you know that you have the correct path to your "key.jks" file. Then try introducing the poperties file (keystoreProperties) Like

storeFile file(keystoreProperties['storeFile']) 

This did not work at first, but it does now :)

So check again that you "key.jks" and "key.properties" files are located the "correct" places, and how you point to them.

Lezlie answered 12/2, 2019 at 10:5 Comment(4)
Does this actually solve the question? It sounds like you are just describing an issue you had and how you solved it.Revel
I hope so, but I cannot know, we can only know when op returns. . it solved my issue which looks like the same issue as the OP. The error screens described by the op and the process was the same that I went though. and the fix was providing the correct paths :)Lezlie
I did your fix, and still have this problem. null and null everywhere. Tell me, what is correct path? ex /Users/smth/key.jks but should i quote it? Is it unix syntax of path, or windows?Mistassini
My keystore.jks file is located in "FlutterApp/android/app/keystore.jks". which is next to "FlutterApp/android/app/build.gradle". Be aware that there are two build.gradle files in a flutter project.Lezlie
D
27

If you downloaded the app from github, it is possible that signing configs are note adapted. Try like this to comment code on 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
    }
   */`

Solution find on : https://github.com/transistorsoft/flutter_background_geolocation/issues/18

Deadlock answered 15/8, 2019 at 20:9 Comment(0)
A
4
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")
Aurthur answered 16/8, 2022 at 6:19 Comment(0)
S
3

I have used the

storeFile file(keystoreProperties['storeFile'])

on compiling it had thrown an error. But after replacing the above line with

storeFile file("key.jks")

Build was successful. I don't know how that has happened, though.

Shooin answered 31/7, 2020 at 6:21 Comment(3)
If you want to know something then you post a question, if you want to show how to resolve a problem you post an answer. Do you want to present this as a solution (remove the phrase with the question mark) or do you want an answer (then ask a new question)?Redpoll
The solution they have stated had resulted in the build error once after changing the code line to ' storeFile file("key.jks")' the build succeeded. And I just want to give the answer that both solutions imply irrespective to their working methodologyShooin
I want to know where to paste key file so that it can runBojorquez
H
2

If you are just testing or debugging and not releasing, you might consider changing the build type to be debug instead of release.

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

buildTypes {
        release {
            signingConfig signingConfigs.debug
       }
    }
Heliport answered 28/6, 2019 at 20:50 Comment(0)
G
0

1)Check the Key in this Project"key.jks"

Go to "gradle.build"

and replace it

storeFile file("key.jks")  

with

storeFile file(keystoreProperties['storeFile']) 
Giuseppe answered 14/10, 2019 at 15:38 Comment(0)
T
0

There must be 2 files one with suffix

  1. "debug"
  2. "release" Add these two file in your project through file explorer Then edit the path in your file known as local.properties
  3. debugStoreFile=C:/Users/Sachin/Android_Studio_project...
  4. storeFile=C:/Users/Sachin/Android_Studio_project...
Teeters answered 25/1, 2021 at 7:46 Comment(0)
S
0

it works for me after deleting or comments

these lines(related to App key signing) from "build.gradle" file

//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
Smoothbore answered 8/5, 2022 at 8:17 Comment(0)
R
0

this worked for me

Replace: storeFile file(keystoreProperties['storeFile'])

to: storeFile file("key.jks")

Raber answered 15/1, 2023 at 21:15 Comment(0)
P
0

Though the popular ans will do, second approach-> u need to add null check to storefile in path(android/app/build.gradle)

    signingConfigs{
      release {
        keyAlias keystoreProperties['keyAlias']
        keyPassword keystoreProperties['keyPassword']
        // storeFile file(keystoreProperties['storeFile'])
        storeFile keystoreProperties['storeFile'] file(keystoreProperties['storeFile']) : null
        storePassword keystoreProperties['storePassword']
    }
}
Piling answered 30/4 at 9:34 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.