Repository navigation
java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onInputConnectionLocked()" #40126
Copy link
Copy link
Closed
Labels
a: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consolec: regressionIt was better in the past than it is nowIt was better in the past than it is nowengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Description
Application will immediately crashed when tap on TextField on Android.
Steps to Reproduce
- Place any
TextFieldinState. - Tap on
TextFieldto make it focused.
Logs
E/flutter (16719): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onInputConnectionLocked()"
E/flutter (16719): at io.flutter.plugin.platform.VirtualDisplayController.onInputConnectionLocked(VirtualDisplayController.java:166)
E/flutter (16719): at io.flutter.plugin.platform.PlatformViewsController.lockInputConnection(PlatformViewsController.java:370)
E/flutter (16719): at io.flutter.plugin.platform.PlatformViewsController.access$1000(PlatformViewsController.java:36)
E/flutter (16719): at io.flutter.plugin.platform.PlatformViewsController$1.resizePlatformView(PlatformViewsController.java:165)
E/flutter (16719): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.resize(PlatformViewsChannel.java:120)
E/flutter (16719): at io.flutter.embedding.engine.systemchannels.PlatformViewsChannel$1.onMethodCall(PlatformViewsChannel.java:57)
E/flutter (16719): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:222)
E/flutter (16719): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:96)
E/flutter (16719): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:656)
E/flutter (16719): at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (16719): at android.os.MessageQueue.next(MessageQueue.java:325)
E/flutter (16719): at android.os.Looper.loop(Looper.java:142)
E/flutter (16719): at android.app.ActivityThread.main(ActivityThread.java:6798)
E/flutter (16719): at java.lang.reflect.Method.invoke(Native Method)
E/flutter (16719): at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
E/flutter (16719): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
E/flutter (16719): at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:108)
Here's flutter doctor.
[✓] Flutter (Channel beta, v1.9.1+hotfix.2, on Mac OS X 10.14.6 18G95, locale zh-Hans-CN)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] Android Studio (version 3.5)
[✓] Connected device (2 available)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
a: platform-viewsEmbedding Android/iOS views in Flutter appsEmbedding Android/iOS views in Flutter appsa: text inputEntering text in a text field or keyboard related problemsEntering text in a text field or keyboard related problemsc: crashStack traces logged to the consoleStack traces logged to the consolec: regressionIt was better in the past than it is nowIt was better in the past than it is nowengineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-androidAndroid applications specificallyAndroid applications specifically
Activity
dolphinxx commentedon Sep 10, 2019
I also encountered this issue
flutter doctor -v:dolphinxx commentedon Sep 11, 2019
I noticed the
java.lang.AbstractMethodErrorthrows because an abstract method was invoked, so I simply added empty implements and the error went away.(In my case, the exception throws when thePlatformViewresized.)Add following methods to the class which implements
PlatformViewAlexV525 commentedon Sep 11, 2019
@dolphinxx engine/PlatformView.java
You mean replace these codes?
你指的是替换这些代码吗?
另:个人怀疑仅在国内设备环境出现
dolphinxx commentedon Sep 11, 2019
找到你的代码中实现了PlatformView接口的类,在那个类里加入
AlexV525 commentedon Sep 11, 2019
@dolphinxx 根据你的解答,找到了
flutter_inappbrowser中的实现,添加后已解决,非常感谢!This issue seems related to packages which has been implement with
PlatformView, such asflutter_inappbrowserin my case.I'll create a new issue about it, but the answer that @dolphinxx provides can help others to solve this problem.
maqoo commentedon Sep 11, 2019
I am experiencing this error with web view component (webview_flutter package). We are displaying a map and when changing views size this happens.
AlexV525 commentedon Sep 11, 2019
Same as webview_flutter, those functions hasn't been override until now, and there's a TODO in webview_flutter to implement this but it never lands.
sunil90210 commentedon Sep 11, 2019
I'm facing this error with
google_maps_flutter, whenTextFieldis focused. Issue is there on stable branch(v1.9.1+hotfix.2).I downgraded to
v1.7.8+hotfix.4to get this working, using below commands:rlechetaudemy commentedon Sep 11, 2019
Same error here. To reproduce the error just add some Map widget and call showSearch method.
google_maps_flutter: ^0.5.21
iamstuffed commentedon Sep 12, 2019
https://github.com/flutter/engine/blob/master/shell/platform/android/io/flutter/plugin/platform/PlatformView.java
Default method implementations in interfaces are only supported on Android >= API 24 (Java 8 feature). If you set the app's min sdk to 24, the crashes will probably go away. If your min sdk version is < 24, you'll probably get crashes due to lack of default method implementation support in interfaces.
iamstuffed commentedon Sep 12, 2019
https://developer.android.com/studio/write/java8-support
Min sdk shouldn't matter, according that page.
exgonline commentedon Sep 12, 2019
Updating the Min SDK to 24 worked for me :-)
lanrehnics commentedon Sep 16, 2019
This works but, I really need to set my min SDK to 16 whats the solution for that ..
24 remaining items
fauzipadlaw commentedon Sep 23, 2019
@blasten it didn't fix the issue
audkar commentedon Sep 23, 2019
@mklim I made 100% reproducible project
Steps I make to reproduce:
goNextbutton (without closing keyboard)mklim commentedon Sep 23, 2019
@audkar Thank you! That reproduces it for me too.
mklim commentedon Sep 23, 2019
The root problem appears to be the same as https://issuetracker.google.com/139821726, and not anything to do with Java 1.8 or Proguard like I theorized earlier. Sorry for the confusion. It's actually that the most recent version of Gradle has some extra dexing that has gone wrong in this case because it's not aware that the Flutter app needs to ever use that method in the engine.
Any users who want to stay on Gradle 3.5.0 and fix this should be able to work around this by adding
android.enableDexingArtifactTransform=falseto theirgradle.propertiesfile. I tested this fix out locally and did see it working. Alternatively this can also be worked around by downgrading to Gradle3.4x.@blasten I found a comment from a Gradle developer explaining that this happens when Gradle doesn't have POM information about our dependencies here. This seems like something we should try to fix in the wider Flutter build structure, what do you think?
blasten commentedon Sep 25, 2019
@audkar would you mind including this file https://github.com/flutter/flutter/blob/master/LICENSE in https://github.com/audkar/flutter_abstract_method_issue. I'd like to use your same repro, but I realized that it doesn't have a license.
audkar commentedon Sep 25, 2019
I'm away from my computer. Can't do any advanced work today :) I added default MIT license. Is it ok? @blasten
blasten commentedon Sep 25, 2019
that should be fine. Thank you!
[google_maps_flutter] Avoid AbstractMethod crash (#2113)
[google_maps_flutter] Avoid AbstractMethod crash (flutter-team-archiv…
fixed: flutter debug crash. see: flutter/flutter#40126
[google_maps_flutter] Avoid AbstractMethod crash (flutter-team-archiv…
rtugeek commentedon Mar 10, 2020
I am using Mapbox. facing the same issue.
When TextField is focusing, the keyboard popup up and Scaffold trigger AndroidView resize, then the error occurs.
I fixed this by adding two lines for Scaffold.
But this will cause side effects: the keyboard will block the widget in the bottom inset. take seriously if you want to use it.
lock commentedon Apr 5, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.