Add_To_App Demo can't run in release mode
xyhuangjia opened this issue · comments
黄佳 commented
multiple_flutters 模块 DoubleFlutterActivity 不能显示页面 在release 模式下.
flutter版本号为
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.3.1 21E258 darwin-arm, locale
zh-Hans-CN)
• Flutter version 2.10.4 at /opt/homebrew/Caskroom/flutter/2.10.4/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c860cba910 (2 weeks ago), 2022-03-25 00:23:12 -0500
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
• Android SDK at /Users/huangj/Library/Android/sdk
• Platform android-32, build-tools 32.0.0
• Java binary at: /Applications/Android
Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] IntelliJ IDEA Community Edition (version 2021.1.3)
• IntelliJ at /Applications/IntelliJ IDEA CE.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.66.0)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1
Brett Morgan commented
What error messages do you receive when you attempt to run in release mode?
黄佳 commented
What error messages do you receive when you attempt to run in release mode?
this is error log
2022-04-11 17:09:29.260 4698-5643/? E/SunLightProtector: setLux lux=543
2022-04-11 17:09:29.265 3925-4428/dev.flutter.multipleflutters E/flutter: [ERROR:flutter/shell/common/shell.cc(93)] Dart Unhandled Exception: NoSuchMethodError: No top-level getter 'topMain' declared.
Receiver: top-level
Tried calling: topMain, stack trace: #0 NoSuchMethodError._throwNew (dart:core-patch/errors_patch.dart:222)
2022-04-11 17:09:29.265 3925-4428/dev.flutter.multipleflutters E/flutter: [ERROR:flutter/runtime/dart_isolate.cc(681)] Could not resolve main entrypoint function.
2022-04-11 17:09:29.265 3925-4428/dev.flutter.multipleflutters E/flutter: [ERROR:flutter/runtime/dart_isolate.cc(165)] Could not run the run main Dart entrypoint.
2022-04-11 17:09:29.265 3925-4428/dev.flutter.multipleflutters E/flutter: [ERROR:flutter/runtime/runtime_controller.cc(381)] Could not create root isolate.
2022-04-11 17:09:29.266 3925-4428/dev.flutter.multipleflutters E/flutter: [ERROR:flutter/shell/common/shell.cc(580)] Could not launch engine with configuration.
my code change String "main" to "topMain"
class SingleFlutterActivity : FlutterActivity(), EngineBindingsDelegate {
private val engineBindings: EngineBindings by lazy {
EngineBindings(activity = this, delegate = this, entrypoint = "topMain")
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
engineBindings.attach()
}
override fun onDestroy() {
super.onDestroy()
engineBindings.detach()
}
override fun provideFlutterEngine(context: Context): FlutterEngine? {
return engineBindings.engine
}
override fun onNext() {
val flutterIntent = Intent(this, MainActivity::class.java)
startActivity(flutterIntent)
}
}
Brett Morgan commented
Any ideas what is going wrong here @gaaclarke?
gaaclarke commented
It may be this: flutter/flutter#91841 I'd try on the master channel.
黄佳 commented
It may be this: flutter/flutter#91841 I'd try on the master channel.
thanks. it slove my problem
Iheb Briki commented
still have this problem on my old project it's fully migrated but when I create a new project it works fine