skip to Main Content

I’ve imported an old project into a new android studio/flutter install. Having major issues trying to deploy my app to an android device. I had to change my targetSdkVersion from 27 to 32, because if I don’t, this new version of Gradle throws errors. with targetSdkVersion 32 set, the most recent version of location I can use is ‘location: ^3.2.4’. Can’t use 4+ otherwise I get conflicts with other dependencies.

Now I’m getting this error:

FlutterLocationService.kt: (149, 5): 'onRequestPermissionsResult' overrides nothing

I have searched it and I can’t make sense of this solution:
'onRequestPermissionsResult' overrides nothing

I’ve tried the solutions posted here:
https://github.com/Lyokone/flutterlocation/issues/698

None worked for me.

Changing

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

to

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

results in the following error:

e: C:srcflutter.pub-cachehostedpub.dartlang.orglocation-3.2.4androidsrcmainjavacomlyokonelocationFlutterLocationService.kt: (149, 5): Conflicting overloads: public open fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray): Boolean defined in com.lyokone.location.FlutterLocationService, public open fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray): Boolean defined in com.lyokone.location.FlutterLocationService
e: C:srcflutter.pub-cachehostedpub.dartlang.orglocation-3.2.4androidsrcmainjavacomlyokonelocationFlutterLocationService.kt: (179, 5): Conflicting overloads: public open fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray): Boolean defined in com.lyokone.location.FlutterLocationService, public open fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray): Boolean defined in com.lyokone.location.FlutterLocationService

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':location:compileDebugKotlin'.

so there is some sort of conflict here?:

    override fun onRequestPermissionsResult(
        requestCode: Int,
        permissions: Array<out String>,
        grantResults: IntArray
    ): Boolean {
        TODO("Not yet implemented")
    }
}

edit: I tried implementing the code posted by user: gustysetyono.

result:

Exception: Unsupported Android Plugin version: 4.2.2.

edit: here’s more info on the above exception:

java.lang.NullPointerException
    at com.intellij.openapi.wm.impl.ToolWindowDragHelper.getBoundsOnScreen(ToolWindowDragHelper.kt:271)
    at com.intellij.openapi.wm.impl.ToolWindowDragHelper.access$getBoundsOnScreen(ToolWindowDragHelper.kt:32)
    at com.intellij.openapi.wm.impl.ToolWindowDragHelper$relocate$1.run(ToolWindowDragHelper.kt:348)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:776)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:727)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:746)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:885)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:754)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:441)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:825)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:440)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:794)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:492)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)

I don’t understand. Anybody know how to resolve this?

2

Answers


  1. Chosen as BEST ANSWER

    Nothing fixed this mess. I ended up having to pull an old version of my code and update everything manually. flutter SDK is terrible.


  2. Changing

    override fun onRequestPermissionsResult(requestCode: Int, permissions:
    Array?, grantResults: IntArray?): Boolean

    to

    override fun onRequestPermissionsResult(requestCode: Int, permissions:
    Array, grantResults: IntArray): Boolean

    This fixed your first issue, the second one is related to the Flutter package location that your plugin depends on, update it and I guess it should work, also return something in the function since it expects a boolean

    Clean the project, maybe Android Studios’ cache too

    HIH.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search