我正在尝试从我的Flutter应用程序构建apk。我正在使用Algolia本机API,并根据此官方文档 (https://www.algolia.com/doc/guides/building-search-ui/getting-started/how-to/flutter/android/) 修改了我的FlutterActivity:
class MainActivity: FlutterActivity() {
val algoliaAPIAdapter = AlgoliaAPIFlutterAdapter(ApplicationID("****"), APIKey("*********************"))
override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
super.configureFlutterEngine(flutterEngine)
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, "com.algolia/api").setMethodCallHandler { call, result ->
algoliaAPIAdapter.perform(call, result)
}
}
}
很不幸,构建过程出现了以下错误:
e: /Users/martinseubert/development/flutter/.pub-cache/hosted/pub.dartlang.org/twitter_login-4.1.0/android/src/main/kotlin/com/maru/twitter_login/TwitterLoginPlugin.kt: (21, 8): 'public open fun onNewIntent(Intent): Boolean defined in com.maru.twitter_login.TwitterLoginPlugin' clashes with 'protected/*protected and package*/ open fun onNewIntent(Intent): Unit defined in io.flutter.embedding.android.FlutterActivity': return types are incompatible
e: /Users/martinseubert/development/flutter/.pub-cache/hosted/pub.dartlang.org/twitter_login-4.1.0/android/src/main/kotlin/com/maru/twitter_login/TwitterLoginPlugin.kt: (21, 14): Cannot infer visibility for 'fun onNewIntent(p0: Intent): Boolean'. Please specify it explicitly
e: /Users/martinseubert/development/flutter/.pub-cache/hosted/pub.dartlang.org/twitter_login-4.1.0/android/src/main/kotlin/com/maru/twitter_login/TwitterLoginPlugin.kt: (76, 5): 'onNewIntent' overrides nothing
任何想法,用flutter build apk构建时出了什么问题?我根本没有使用 Twitter 登录,只添加了
firebase_auth
以供 Google 登录使用。我当前正在使用 ext.kotlin_version = '1.6.10'
。
以下是我的 flutter doctor 输出:
[✓] Flutter (Channel beta, 2.12.0-4.1.pre, on macOS 12.3.1 21E258 darwin-arm, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2020.3)
[✓] VS Code (version 1.66.0)
[✓] Connected device (1 available)
[✓] HTTP Host Availability