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

[Bug] Execution failed for task ':barcode_scan2:compileDebugKotlin'. #49

Closed
Harishwarrior opened this issue May 12, 2022 · 9 comments · Fixed by #50
Closed

[Bug] Execution failed for task ':barcode_scan2:compileDebugKotlin'. #49

Harishwarrior opened this issue May 12, 2022 · 9 comments · Fixed by #50
Labels
bug Something isn't working

Comments

@Harishwarrior
Copy link

Harishwarrior commented May 12, 2022

Describe the bug
The project throws an error after upgrading to flutter 3.0

To Reproduce

  • Update to Flutter 3.0

Logs

e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (16, 1): Class 'ActivityHelper' 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: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (71, 5): 'onRequestPermissionsResult' overrides nothing
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 58): Type mismatch: inferred type is Array<CapturedType(out String)>? but Array<(out) String!> was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 71): Type mismatch: inferred type is IntArray? but IntArray was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ChannelHandler.kt: (64, 39): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\RequestCameraPermissionHandler.kt: (8, 1): Class 'RequestCameraPermissionHandler' 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: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\RequestCameraPermissionHandler.kt: (11, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception.

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

Additional context

Doctor summary (to see all details, run flutter doctor -v):
[] Flutter (Channel stable, 3.0.0, on Microsoft Windows [Version 10.0.22000.675], locale en-US)
[] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[X] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[] Android Studio (version 2021.2)
[] VS Code (version 1.67.0)
[] Connected device (3 available)
[] HTTP Host Availability

Possible cause

e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (16, 1): Class 'ActivityHelper' 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
@Harishwarrior Harishwarrior added the bug Something isn't working label May 12, 2022
@Harishwarrior Harishwarrior changed the title [Bug] [Bug] Execution failed for task ':barcode_scan2:compileDebugKotlin'. May 12, 2022
@Constans
Copy link

It also happens on macOS:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.0.0, on macOS 12.3.1 21E258 darwin-arm, locale en-NL)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2021.3.1)
[✓] IntelliJ IDEA Community Edition (version 2021.3)
[✓] VS Code (version 1.66.1)
[✓] Connected device (2 available)
[✓] HTTP Host Availability

• No issues found!

@Constans
Copy link

Got it to work after manually solving the signalled issues in the de/mintware/barcode_scan/ActivityHelper.kt, de/mintware/barcode_scan/ChannelHandler.kt, and de/mintware/barcode_scan/RequestCameraPermissionHandler.kt files.
Fixing means removing the ? operator.

@Harishwarrior
Copy link
Author

Got it to work after manually solving the signalled issues in the de/mintware/barcode_scan/ActivityHelper.kt, de/mintware/barcode_scan/ChannelHandler.kt, and de/mintware/barcode_scan/RequestCameraPermissionHandler.kt files.
Fixing means removing the ? operator.

Can you elaborate on how you fixed it?

@Constans
Copy link

Constans commented May 12, 2022

The causing errors are really here for you:

e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 58): Type mismatch: inferred type is Array<CapturedType(out String)>? but Array<(out) String!> was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 71): Type mismatch: inferred type is IntArray? but IntArray was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ChannelHandler.kt: (64, 39): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected

The error tells you what was provided and what is expected. So you remove the trailing ? operator on these and provide what it expects.
Then the other errors will go away because they complain about function signatures.

The long term fix will probably come from the package maintainer. This is just a fix to get your project building.

@Harishwarrior
Copy link
Author

The causing errors are really here for you:

e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 58): Type mismatch: inferred type is Array<CapturedType(out String)>? but Array<(out) String!> was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ActivityHelper.kt: (81, 71): Type mismatch: inferred type is IntArray? but IntArray was expected
e: C:\Users\Harish\AppData\Roaming\Pub\Cache\hosted\pub.dartlang.org\barcode_scan2-4.2.0\android\src\main\kotlin\de\mintware\barcode_scan\ChannelHandler.kt: (64, 39): Type mismatch: inferred type is BinaryMessenger? but BinaryMessenger was expected

The error tells you what was provided and what is expected. So you remove the trailing ? operator on these and provide what it expects.
Then the other errors will go away because they complain about function signatures.

The long term fix will probably come from the package maintainer. This is just a fix to get your project building.

Thanks

@as2a3
Copy link

as2a3 commented May 12, 2022

@Harishwarrior
If you solved this issue, can you upload files which had edited?

@Harishwarrior
Copy link
Author

@Harishwarrior
If you solved this issue, can you upload files which had edited?

I'll work on this tomorrow. Will update.

@robinbonnes
Copy link
Contributor

I've created a PR here: #50

You can use my repository for now, enter in your pubspec.yaml:

  barcode_scan2:
    git:
      url: https://github.com/robinbonnes/barcode_scan2

@Harishwarrior
Copy link
Author

I've created a PR here: #50

You can use my repository for now, enter in your pubspec.yaml:

  barcode_scan2:
    git:
      url: https://github.com/robinbonnes/barcode_scan2

Thanks man

@mono0926 mono0926 linked a pull request May 13, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants