Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FAILURE: Build failed with an exception. #22

Open
nan-medeiros opened this issue Dec 14, 2023 · 11 comments
Open

FAILURE: Build failed with an exception. #22

nan-medeiros opened this issue Dec 14, 2023 · 11 comments

Comments

@nan-medeiros
Copy link

nan-medeiros commented Dec 14, 2023

Hi,

I'm develloping in Flutter 3.16.3 on Microsoft Windows 11 for Android. So, I decide to try this package, and I just did flutter pub add dargon2_flutter and this put a line in the yaml -> " dargon2_flutter: ^3.3.0". Till now none implementation. At this point I tried to run the project - even with none implementation just the yaml depency - and got this:

 Launching lib\main.dart on Android SDK built for x86 in debug mode...
Plugin project :dargon2_flutter_mobile not found. Please update settings.gradle.

FAILURE: Build failed with an exception.

* Where:
Build file 'D:\dev\Android\desenv\criptografia_2\android\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
> Cannot invoke method afterEvaluate() on null object

* 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 7s
Exception: Gradle task assembleDebug failed with exit code 1
Exited (1).

Do you have any clue about what is happening and what can I do to use sucefully this package?
Thank you. Nan Medeiros

@nan-medeiros
Copy link
Author

Additionally to the problem reported in the build.gradle of this project I opened this file and I found nothing wrong:

buildscript {
    ext.kotlin_version = '1.7.10'
    repositories {
        google()
        mavenCentral()
    }

    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = '../build'
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(':app')
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

@nan-medeiros
Copy link
Author

To be sure the problem is just with this package, I started a new empty project, with a default Flutter counter and then I added this package: the same result. This error comes when I tried run the application. If I remove the package its run normally.

@ChoLianJiet
Copy link

Im facing the same issue as well when running on android device

@nan-medeiros
Copy link
Author

@ChoLianJiet I'll trully do like to receive some kind of feedback from the author. Just to show us that this is a valid package still.

@tmthecoder
Copy link
Owner

Hi, this is still maintained.

Is NDK installed on your machine? It's needed to run the dargon2 native compilation. Not sure if that's the error but it very well might be. If not, I can dig deeper and try to reproduce

@nan-medeiros
Copy link
Author

Although I'm using VSCode and not Android Studio, I installed the NDK using Android Studio . Well, the error message is the same in VSCode:

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Plugin project :dargon2_flutter_mobile not found. Please update settings.gradle.

FAILURE: Build failed with an exception.
* Where:
Build file 'D:\dev\Android\desenv\criptografia_2\android\build.gradle' line: 25

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Cannot invoke method afterEvaluate() on null object

* 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 33s
Exception: Gradle task assembleDebug failed with exit code 1

Exited (1).

@qui-jason
Copy link

Any word on this @tmthecoder? Same result here:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode...
Plugin project :dargon2_flutter_mobile not found. Please update settings.gradle.

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/********/android/build.gradle' line: 13

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Cannot invoke method afterEvaluate() on null object

* 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 527ms

Happy to assist if you give some guidance, I know many languages and have built some FFIs in the past - I simply know very little about Dart/Flutter/Android.

Works on iOS, but I needed to add this line in my Podfile:

  pod 'Argon2Swift'

Thanks in advance.

@qui-jason
Copy link

qui-jason commented Feb 25, 2024

https://docs.flutter.dev/packages-and-plugins/developing-packages#step-2-building-and-bundling-native-code

Adding ffiPlugin: true to your code in dargon2_flutter_mobile/pubspec.yaml seems to do the trick for me, though I needed to include the build in my project gradle file and there were warnings about toolkit versions.

I should be clear, I haven't reached the point where I've verified the Argon2 invocation - I've just got the app running on a simulator.

Edit: I verified the Argon2 calls work correctly.

@qui-jason
Copy link

Also verified that with ffiPlugin set to true, iOS no longer seems to require the Podfile addition of Argon2Swift. I ran flutter clean after removing the dependency and subsequent invocations of flutter run didn't complain.

@qui-jason
Copy link

Here's a branch I made that I am currently using to build your package for my project:
https://github.com/confirm-community/dargon2/tree/fix-ffi-build
The pubspec.yml files are all hacked to use local paths, obviously that is not intended in a commit to your repo. I also updated the toolchain a bit, not sure if that was necessary. Hope this helps.

@dan-at-confirm
Copy link

I opened the above PR with a stripped down version of @qui-jason's work.

I cannot make any assertions about it, I've just opened it as a public service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants