dargon2 icon indicating copy to clipboard operation
dargon2 copied to clipboard

FAILURE: Build failed with an exception.

Open nan-medeiros opened this issue 1 year ago • 11 comments

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 avatar Dec 14 '23 18:12 nan-medeiros

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 avatar Dec 14 '23 19:12 nan-medeiros

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.

nan-medeiros avatar Dec 14 '23 19:12 nan-medeiros

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

ChoLianJiet avatar Dec 28 '23 08:12 ChoLianJiet

@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.

nan-medeiros avatar Dec 28 '23 11:12 nan-medeiros

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

tmthecoder avatar Dec 28 '23 12:12 tmthecoder

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).

nan-medeiros avatar Dec 28 '23 22:12 nan-medeiros

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 avatar Feb 25 '24 18:02 qui-jason

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 avatar Feb 25 '24 21:02 qui-jason

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 avatar Feb 26 '24 01:02 qui-jason

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.

qui-jason avatar Feb 29 '24 08:02 qui-jason

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

dan-at-confirm avatar Mar 12 '24 14:03 dan-at-confirm