Skip to content

Unresolved reference: Registrar in cryptography_flutter during Android build #195

@mrlukyman

Description

@mrlukyman

Description
I'm encountering a build failure on Android with the error e: file:///Users/lukasharing/.pub-cache/hosted/pub.dev/cryptography_flutter-2.3.2/android/src/main/kotlin/dev/dint/cryptography_flutter/CryptographyFlutterPlugin.kt:24:48 Unresolved reference: Registrar. This seems to be related to the cryptography_flutter plugin during the compilation of its Kotlin code.

Steps to Reproduce

  1. Ensure cryptography_flutter is included in the pubspec.yam file. (Specify the version you are using, which is ^2.3.0 based on your provided plugin versions).
  2. Run flutter clean.
  3. Run flutter pub get.
  4. Attempt to build the Android application using flutter build apk --release or flutter run.

Expected Behavior
The Android application should build successfully without compilation errors.

Actual Behavior
The build fails with the Unresolved reference: Registrar error in the cryptography_flutter plugin's Kotlin code.

Error Output

e: file:///Users/lukasharing/.pub-cache/hosted/pub.dev/cryptography_flutter-2.3.2/android/src/main/kotlin/dev/dint/cryptography_flutter/CryptographyFlutterPlugin.kt:24:48 Unresolved reference: Registrar

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':cryptography_flutter:compileReleaseKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
   > Compilation error. See log for more details

* 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 2s
Error: Gradle task assembleRelease failed with exit code 1
#0      throwToolExit (package:flutter_tools/src/base/common.dart:34:3)
#1      AndroidGradleBuilder.buildGradleApp (package:flutter_tools/src/android/gradle.dart:582:7)
<asynchronous suspension>
#2      AndroidGradleBuilder.buildApk (package:flutter_tools/src/android/gradle.dart:242:5)
<asynchronous suspension>
#3      AndroidDevice.startApp (package:flutter_tools/src/android/android_device.dart:573:7)
<asynchronous suspension>
#4      FlutterDevice.runCold (package:flutter_tools/src/resident_runner.dart:490:33)
<asynchronous suspension>
#5      ColdRunner.run (package:flutter_tools/src/run_cold.dart:55:28)
<asynchronous suspension>
#6      AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:819:9)
<asynchronous suspension>
#7      Future.any.onValue (dart:async/future.dart:616:5)
<asynchronous suspension>

Flutter Doctor Output

[✓] Flutter (Channel stable, 3.32.0, on macOS 15.4.1 24E263 darwin-arm64, locale en-US) [864ms]
    • Flutter version 3.32.0 on channel stable at /Users/lukasharing/fvm/versions/3.32.0
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision be698c48a6 (10 days ago), 2025-05-19 12:59:14 -0700
    • Engine revision 1881800949
    • Dart version 3.8.0
    • DevTools version 2.45.1

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1,972ms]
    • Android SDK at /Users/lukasharing/Library/Android/sdk
    • Platform android-35, build-tools 35.0.0
    • ANDROID_HOME = /Users/lukasharing/Library/Android/sdk
    • Java binary at: /Users/lukasharing/Library/Java/JavaVirtualMachines/jbr-17.0.12/Contents/Home/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment JBR-17.0.12+1-1207.37-nomod (build 17.0.12+1-b1207.37)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 16.3) [797ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16E140
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [12ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2024.3) [11ms]
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)

[✓] VS Code (version 1.100.1) [9ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.110.0

[✓] Connected device (4 available) [6.0s]
    • Raspberry Pi 5 (mobile)            • 172.16.20.16:5555         • android-arm64  • Android 14 (API 34)
    • Luky’s iPhone1 (wireless) (mobile) • 00008120-001A7DD10E60C01E • ios            • iOS 18.5 22F76
    • macOS (desktop)                    • macos                     • darwin-arm64   • macOS 15.4.1 24E263 darwin-arm64
    • Chrome (web)                       • chrome                    • web-javascript • Google Chrome 136.0.7103.114

[✓] Network resources [1,016ms]
    • All expected network resources are available.

• No issues found!

Plugin Versions
cryptography: ^2.7.0
cryptography_flutter: ^2.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions