jeroentrappers / flutter_keychain

A flutter plugin for secure storage on Android via KeyStore and iOS via Keychain
Other
56 stars 41 forks source link

After installation got error: inferred type is String? but String was expected #21

Closed NikonovichN closed 3 years ago

NikonovichN commented 3 years ago

Hello everyone!

After installation this package I can`t run application. I get error only for Android:

.../flutter/.pub-cache/hosted/pub.dartlang.org/flutter_keychain-2.0.0/android/src/main/kotlin/be/appmire/flutterkeychain/FlutterKeychainPlugin.kt: (320, 39): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':flutter_keychain:compileDebugKotlin'.
> 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 5s
Exception: Gradle task assembleDebug failed with exit code 1

My environment: Android Studio 4.2.1 Flutter 2.2.0 Kotlin 202-1.5.0-release-764-AS8194.7

Any clues? Thanks! @jeroentrappers

cconstab commented 3 years ago

I had the same issue... But by editing android/app/build.gradle to downgrade to targetSdkVersion 29 everything works again..

    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId "com.example.login_app"
        minSdkVersion 24
        targetSdkVersion 29
        versionCode flutterVersionCode.toInteger()
        versionName flutterVersionName
    }

This will probably work for a short term fix as to to the underlying issue, I have not investigated..

ZacharieAzoulai commented 3 years ago

I'm also facing this issue..

wbusey0 commented 3 years ago

Replacing FlutterKeychainPlugin.kt: (320, 39) with the following should help: Log.e("flutter_keychain", e.message ?: e.toString())

jeroentrappers commented 3 years ago

Thanks for the PR @wbusey0 . New version 2.0.1 released.