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

Building example app failed #11

Open
itanium21 opened this issue Jul 3, 2022 · 3 comments
Open

Building example app failed #11

itanium21 opened this issue Jul 3, 2022 · 3 comments

Comments

@itanium21
Copy link

itanium21 commented Jul 3, 2022

Hi!
Tried to build your example app from https://pub.dev/packages/background_stt/example with latest flutter (3.0.2), latest Android SDK, but it failed:

Running Gradle task 'assembleDebug'...
e: C:\flutter.pub-cache\hosted\pub.dartlang.org\background_stt-1.0.6\android\src\main\kotlin\com\umair\background_stt\BackgroundSttPlugin.kt: (25, 1): Class 'BackgroundSttPlugin' 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:\flutter.pub-cache\hosted\pub.dartlang.org\background_stt-1.0.6\android\src\main\kotlin\com\umair\background_stt\BackgroundSttPlugin.kt: (48, 32): Type mismatch: inferred type is Activity? but Context was expected
e: C:\flutter.pub-cache\hosted\pub.dartlang.org\background_stt-1.0.6\android\src\main\kotlin\com\umair\background_stt\BackgroundSttPlugin.kt: (247, 5): 'onRequestPermissionsResult' overrides nothing

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':background_stt: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.

BUILD FAILED in 9s
Exception: Gradle task assembleDebug failed with exit code 1

Latest flutter (3.0.2), latest Android SDK

Any ideas?

@ymyex
Copy link

ymyex commented Feb 1, 2023

Ya I had the same problem and I solved it,
navigate to the error file (BackgroundSttPlugin.kt), go to the end of it and you will see:
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>?, grantResults: IntArray?): Boolean { if (requestCode == REQUEST_RECORD_PERMISSIONS && grantResults?.isNotEmpty()!! && grantResults[0] == PackageManager.PERMISSION_GRANTED) { doIfPermissionsGranted() return true } return false }

or some thing like that, just remove the "?" question marks in : Array<out String>? and grantResults: IntArray? and grantResults?.isNotEmpty()!!.

Next, go to the line where you can find setUpPluginMethods(registrar.activity(), registrar.messenger()), just replace the .activity() with .context()

@williamrech
Copy link

@umair13adil, i did exactly what @ymyex said and it worked like a charm. Currently testing app perfeormance long term with this service running.
Is it possible for you to update this blessed plugin again? It would be much appreciated, thank you.

@umair13adil
Copy link
Owner

@williamrech Sure, let me update this plugin sometime this week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants