我是android开发的新手。我们使用flutter开发我们的应用程序。最近我们发现有一个错误。当我们安装该应用程序后,并第一次拍照,该应用程序将崩溃。这是日志
W/libEGL (14538): EGLNativeWindowType 0x79dd857010 disconnect failed
D/ViewRootImpl[MainActivity](14538): surface should not be released
W/libEGL (14538): EGLNativeWindowType 0x79d7690010 disconnect failed
E/ (14538): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
D/ZrHung.AppEyeUiProbe(14538): notify runnable to start.
D/ZrHung.AppEyeUiProbe(14538): restart watching
I/HwPhoneWindow(14538): updateLayoutParamsColor false mSpecialSet=true, mForcedNavigationBarColor=true, navigationBarColor=ff000000, mNavBarShow=true, mIsFloating=false
I/HwPhoneWindow(14538): updateLayoutParamsColor false mSpecialSet=true, mForcedNavigationBarColor=true, navigationBarColor=ff000000, mNavBarShow=true, mIsFloating=false
D/mali_winsys(14538): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
D/mali_winsys(14538): EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
E/BpSurfaceComposerClient(14538): Failed to transact (-1)
E/BpSurfaceComposerClient(14538): Failed to transact (-1)
I/ViewRootImpl(14538): jank_removeInvalidNode all the node in jank list is out of time
W/o.rakuten.plaza(14538): type=1400 audit(0.0:1351): avc: granted { create } for name="image-_20191123_1500094155171443712191881.jpg" scontext=u:r:untrusted_app:s0:c203,c256,c512,c768 tcontext=u:object_r:sdcardfs:s0:c203,c256,c512,c768 tclass=file
W/InputMethodManager(14538): startInputReason = 1
D/ZrHung.AppEyeUiProbe(14538): stop checker.
E/ (14538): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
W/System (14538): A resource failed to call close.
E/AndroidRuntime(14538): FATAL EXCEPTION: DefaultDispatcher-worker-5
E/AndroidRuntime(14538): Process: XXXX, PID: 14538
E/AndroidRuntime(14538): java.lang.IllegalStateException: Reply already submitted
E/AndroidRuntime(14538): at io.flutter.embedding.engine.dart.DartMessenger$Reply.reply(DartMessenger.java:135)
E/AndroidRuntime(14538): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler$1.success(MethodChannel.java:225)
E/AndroidRuntime(14538): at XXXX.MainActivity$onActivityResult$1$invokeSuspend$$inlined$let$lambda$1.invokeSuspend(MainActivity.kt:94)
E/AndroidRuntime(14538): at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
E/AndroidRuntime(14538): at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
E/AndroidRuntime(14538): at android.os.Handler.handleCallback(Handler.java:907)
E/AndroidRuntime(14538): at android.os.Handler.dispatchMessage(Handler.java:105)
E/AndroidRuntime(14538): at android.os.Looper.loop(Looper.java:216)
E/AndroidRuntime(14538): at android.app.ActivityThread.main(ActivityThread.java:7625)
E/AndroidRuntime(14538): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(14538): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:524)
E/AndroidRuntime(14538): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:987)
I/Process (14538): Sending signal. PID: 14538 SIG: 9
Lost connection to device.
似乎是主要活动重新开始。我认为问题可能出在我之前对kotlin版本进行的修改。在这里
是因为这个吗?
基于@HB的建议。我做了以下修改
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
when (requestCode) {
LOGIN_CODE ->
if (resultCode == RESULT_OK) {
if (LoginManager.getInstance().loginService.isLoggedIn) {
GlobalScope.launch {
async {
var ls = LoginManager.getInstance().loginService
var response = ls.authRequest<AuthResponse<TokenResult>>(AUTH_PROVIDER_NAME)
return@async response.getToken()
}.await().let {
withContext(Dispatchers.Main){
methodResult?.success(it)
methodResult=null
}
}
}
}
} else {
methodResult?.success("")
methodResult=null
}
LOGOUT_CODE ->
if (resultCode == RESULT_OK) {
methodResult?.success(true)
methodResult=null
}
REQUEST_CODE_TAKE_IMAGE_WITH_CAMERA -> {
if (data != null && resultCode != RESULT_OK) {
methodResult?.success("")
methodResult=null
}
}
REQUEST_CODE_CHOOSE_IMAGE_FROM_GALLERY -> {
if (data != null && resultCode != RESULT_OK) {
methodResult?.success("")
methodResult=null
}
}
else -> {
methodResult?.success("")
methodResult=null
}
}
}