-
Notifications
You must be signed in to change notification settings - Fork 26.7k
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
java.lang.AbstractMethodError: abstract method "void io.flutter.plugin.platform.PlatformView.onInputConnectionLocked()" #40126
Comments
I also encountered this issue
|
I noticed the Add following methods to the class which implements
|
@dolphinxx engine/PlatformView.java 另:个人怀疑仅在国内设备环境出现 |
找到你的代码中实现了PlatformView接口的类,在那个类里加入
|
@dolphinxx 根据你的解答,找到了 This issue seems related to packages which has been implement with |
I am experiencing this error with web view component (webview_flutter package). We are displaying a map and when changing views size this happens. |
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. |
I'm facing this error with I downgraded to
|
Same error here. To reproduce the error just add some Map widget and call showSearch method. google_maps_flutter: ^0.5.21
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
class MapaBugPage extends StatefulWidget {
@override
_MapaRevendasPageState createState() => _MapaRevendasPageState();
}
class _MapaRevendasPageState extends State<MapaBugPage>
with TickerProviderStateMixin {
Completer<GoogleMapController> _controller = Completer();
@override
void initState() {
super.initState();
}
@protected
void onMapCreated(GoogleMapController controller) async {
_controller.complete(controller);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.white,
title: Text(
"Map Bug 2",
),
actions: [
IconButton(
icon: Icon(Icons.search),
onPressed: _onClickSearch,
)
],
),
body: Container(
child: GoogleMap(
mapType: MapType.normal,
myLocationEnabled: true,
myLocationButtonEnabled: true,
zoomGesturesEnabled: true,
onMapCreated: onMapCreated,
initialCameraPosition:
CameraPosition(target: LatLng(-8.628117, -55.377721), zoom: 4),
),
),
);
}
void _onClickSearch() async {
try {
dynamic obj = await showSearch(
context: context,
delegate: BasicSearch(),
);
print(obj);
} catch (e) {
print(e);
}
}
}
class BasicSearch extends SearchDelegate {
@override
List<Widget> buildActions(BuildContext context) {
// TODO: implement buildActions
return null;
}
@override
Widget buildLeading(BuildContext context) {
// TODO: implement buildLeading
return null;
}
@override
Widget buildResults(BuildContext context) {
// TODO: implement buildResults
return null;
}
@override
Widget buildSuggestions(BuildContext context) {
// TODO: implement buildSuggestions
return null;
}
} |
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. |
https://developer.android.com/studio/write/java8-support |
Updating the Min SDK to 24 worked for me :-) |
This works but, I really need to set my min SDK to 16 whats the solution for that .. |
@mklim not all plugins which use |
Anybody who tested it out now ? I need to consider soon for an App release if i should go with Flutter 1.9 or to downgrade flutter. |
This comment has been minimized.
This comment has been minimized.
I have 1.8 java compatibility on our project. But this problems still reproducible 100% Strange thing is that it happens only on Android 10 devices/emulators for me. plugin with platform view: Edit:
|
But even if setting target java level 1.8 would help... IMHO this still not the best approach.
So after updating Flutter to 1.9 stable developers will have very hard time finding this problem themself. Maybe better would be to get rid of |
@audkar thanks for trying it out and the detailed info. Yeah, a surprise breakage like this is not desirable. When the change landed I don't think we realized it would be breaking for anyone. Unfortunately even matching all of that configuration I haven't been able to reproduce and debug this further so far. I'm still attempting to find reproduction, but if you or anyone else on this thread can post a reduced sample case triggering this bug that would be extremely helpful. I think Gradle specific configuration is likely involved, so build files would be great to include too. |
One more question: are the people affected like this using any kind of tree shaking in their code, like ProGuard? From what I can tell it's not expected to see this kind of error at runtime, and the more normal case is compile time failures. @maqoo and @AlexVincent525, what version of |
@mklim In my case, |
In my case, google_maps_flutter 0.5.21, gradle 5.6.2, no kotlin and TextField tap. |
As suggested by @lanrehnics downgrading gradle works. @pamir72 My release build is passing. Proguard rules:
|
@sunil90210 My ProGuard-rules: #Flutter Wrapper -keep class com.google.android.gms.** { ; } -keepattributes Signature -dontwarn kotlin.** -dontnote com.google.firebase.** -keep class com.flutter_webview_plugin.** { *; } |
If you have problems with #40168 issue. Then go discuss solutions on that ticket please. |
Stable switched to Kotlin for new projects, but the Flutter plugin is missing this config: android {
...
// For Kotlin projects
kotlinOptions {
jvmTarget = "1.8"
}
} The Flutter Gradle plugin already sets 1.8 for but this affects Java projects only. Could anyone confirm that adding the above snippet to |
This did not fix the isssue for me |
@blasten it didn't fix the issue |
@audkar Thank you! That reproduces it for me too. |
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 @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? |
@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. |
I'm away from my computer. Can't do any advanced work today :) I added default MIT license. Is it ok? @blasten |
that should be fine. Thank you! |
Override a default method to work around flutter/flutter#40126. The root cause of the issue has already been fixed in master and there is a potential workaround available to apps already, but this is an extra low-risk change that should prevent the crash for any affected users while the fix is still rolling out to stable.
Override a default method to work around flutter/flutter#40126. The root cause of the issue has already been fixed in master and there is a potential workaround available to apps already, but this is an extra low-risk change that should prevent the crash for any affected users while the fix is still rolling out to stable.
Override a default method to work around flutter/flutter#40126. The root cause of the issue has already been fixed in master and there is a potential workaround available to apps already, but this is an extra low-risk change that should prevent the crash for any affected users while the fix is still rolling out to stable.
I am using Mapbox. facing the same issue.
But this will cause side effects: the keyboard will block the widget in the bottom inset. take seriously if you want to use it. |
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 |
Application will immediately crashed when tap on
TextField
on Android.Steps to Reproduce
TextField
inState
.TextField
to make it focused.Logs
Here's
flutter doctor
.The text was updated successfully, but these errors were encountered: