QuisApp / flutter_contacts

MIT License
88 stars 143 forks source link

Kotlin compilation error for function 'onRequestPermissionsResult' in beta channel #49

Closed maksym-letiushov closed 2 years ago

maksym-letiushov commented 2 years ago

Hi,

Console output

Running Gradle task 'assembleDebug'...

e: /dir/.pub-cache/hosted/pub.dartlang.org/flutter_contacts-1.1.3/android/src/main/kotlin/co/quis/flutter_contacts/FlutterContactsPlugin.kt: (27, 8): Class 'FlutterContactsPlugin' is not abstract and does not implement abstract member public abstract fun onRequestPermissionsResult(p0: Int, p1: Array<(out) String!>, p2: IntArray): Boolean defined in io.flutter.plugin.common.PluginRegistry.RequestPermissionsResultListener

e: dir/.pub-cache/hosted/pub.dartlang.org/flutter_contacts-1.1.3/android/src/main/kotlin/co/quis/flutter_contacts/FlutterContactsPlugin.kt: (137, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception. What went wrong: Execution failed for task ':flutter_contacts:compileDebugKotlin'.

Found solution

Here is current signature of function onRequestPermissionsResult.

override fun onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<out String>?,
    grantResults: IntArray?
): Boolean

WHEN I CHANGE PARAMETERS TO NON-NULLABLE THEN IT BUILDS SUCCESSFULLY.

override fun onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<out String>,
    grantResults: IntArray
): Boolean

Please use this fix if it's correct or please guide me how to solve issue in the right way. Thanks.

P.S. Additional info

Settings of my app:

pubspec.yaml flutter_contacts: 1.1.3

build.gradle ext.kotlin_version = '1.6.10' classpath 'com.android.tools.build:gradle:7.1.2'

gradle-wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-all.zip

maksym-letiushov commented 2 years ago

These errors appear only in the latest beta channel (Flutter 2.12.0-4.1.pre) and there are no errors in the latest stable channel (Flutter 2.10.3). So, I would suggest to create a new branch beta and provide fix there. Thank you.

rahmanrezaee commented 2 years ago

I also face this issue in flutter 2.10.3 with kotlin version 1.6.10

joachim-quis commented 2 years ago

Thanks for flagging and debugging! Applied your fix in version 1.1.4.

maksym-letiushov commented 2 years ago

Thanks for flagging and debugging! Applied your fix in version 1.1.4.

Thanks 👍