我收到此随机异常,导致在进行翻新的网络通话时崩溃了我的应用程序,并且正在寻找解决方法的指导
Fatal Exception: java.io.InterruptedIOException: thread interrupted
at okio.Timeout.throwIfReached(Timeout.java:145)
at okio.Okio$1.write(Okio.java:76)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
at okio.RealBufferedSink.flush(RealBufferedSink.java:216)
at okhttp3.internal.http2.Http2Writer.flush(Http2Writer.java:121)
at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:239)
at okhttp3.internal.http2.Http2Connection.newStream(Http2Connection.java:205)
at okhttp3.internal.http2.Http2Codec.writeRequestHeaders(Http2Codec.java:111)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:50)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at com.happycorp.happy.happyapp.util.Network$1.intercept(Network.java:80)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at com.happycorp.android.commondata.net.RetrofitFactory$CustomHttpMetricsLogger.intercept(RetrofitFactory.java:139)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at com.happycorp.android.commondata.net.RetrofitFactory$1.intercept(RetrofitFactory.java:83)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.adapter.rxjava2.CallExecuteObservable.subscribeActual(CallExecuteObservable.java:41) …Run Code Online (Sandbox Code Playgroud) 以前的 Fabric SDK 允许这样的检查
if (Fabric.isInitialized()) {
crashSetParam(CrashParameters.ROOT_NODE, nodeInfoCompat.toString())
Crashlytics.logException(ex)
}
Run Code Online (Sandbox Code Playgroud)
我无法确定如何在新的 Firebase Android SDK 中执行此操作,这会导致我的 junit 测试可能会遇到此问题而崩溃。我意识到我可以将它包装在一个界面中,但我也很好奇如何以上面这样的简单方式解决它。谢谢。
我也在github上记录了一个问题:
https://github.com/firebase/firebase-android-sdk/issues/1437
如果没有检查,我们在运行单元测试时会得到这样的结果:
java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process null. Make sure to call FirebaseApp.initializeApp(Context) first.
Run Code Online (Sandbox Code Playgroud)
我现在已经用以下方法修复了它:
fun logException(ex: Throwable, nodeInfoCompat: AccessibilityNodeInfoCompat?) {
// We check to make sure Fabric is initialized or else the tests will fail - see above comment
try {
FirebaseCrashlytics.getInstance().setCustomKey(CrashParameters.ROOT_NODE, nodeInfoCompat.toString())
FirebaseCrashlytics.getInstance().recordException(ex)
} catch (e: IllegalStateException) {
Timber.e(e);
}
}
Run Code Online (Sandbox Code Playgroud) 假设我们有一个@Singleton应用程序模块,它创建并返回一个Hashmap用于存储配置数据的模块.如果配置数据在hashmap中被修改并且android应用程序进入后台并且让我们说onPause()和onStop()被调用.
我正在构建一个 Kotlin/JS 项目,它将用作 Web 应用程序的库。kotlin 插件最近启用了 DCE 并提供了 keep 指令,但它没有保留我指定的类。
kotlin.target.browser {
dceTask {
keep 'BluetoothSerialJs.com.fivestars.bluetooth.BluetoothSerial'
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的类定义的顶部:
package com.fivestars.bluetooth
object BluetoothSerial {
Run Code Online (Sandbox Code Playgroud)
完整的项目在这里:
我试图弄清楚如何将视图模型绑定到底部表,以便我可以使用视图模型上的可观察字段使底部表同时展开、折叠和隐藏。
谢谢!
我正在将一个Flutter移动项目移植到Web上,并且很好奇要使用哪个地图包代替:
尝试构建 kotlin/js 项目并获得以下异常:
error package.json: Name contains illegal characters
Run Code Online (Sandbox Code Playgroud)
该项目在这里:
完整输出:
3:05:37 PM: Executing task 'build'...
Executing tasks: [build] in project /rom/source/fivestars/CordovaAlternativePattern/js
> Configure project :SharedCode
Kotlin Multiplatform Projects are an experimental feature.
> Task :SharedCode:jsPackageJson
> Task :js:packageJson
> Task :js:testPackageJson
> Task :kotlinNodeJsSetup SKIPPED
> Task :kotlinNpmInstall FAILED
error package.json: Name contains illegal characters
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':kotlinNpmInstall'.
> Process 'Resolving NPM dependencies using yarn' returns …Run Code Online (Sandbox Code Playgroud) 我试图在Flutter中设置ExpansionPanel的样式,但颜色不适用于整个面板.我已经尝试过Container和Card小部件,颜色没有更新.有任何想法吗?我想添加背景颜色以覆盖整个ExpansionPanel.有没有办法将父主题添加到ExpansionPanel.
卡
Card(
elevation: 2.0,
color: Theme.of(context).primaryColor,
margin: EdgeInsets.only(left: 10.0,right: 10.0,top: 10.0),
child: ExpansionPanelList(
expansionCallback: (int index, bool isExpanded) {
setState(() {
_items[index].isExpanded = !_items[index].isExpanded;
Timer(Duration(milliseconds: 200), () {
setState(() {
_reconfigureFAB();
});
});
});
},
children: _items.map((IncludedItem item) {
return ExpansionPanel(
headerBuilder: (BuildContext context, bool isExpanded) {
return Container(
padding: EdgeInsets.only(left: 18.0),
child: Row(children: [
Text(
"What's included",
textAlign: TextAlign.start,
style: TextStyle(
fontFamily: 'Bold',
fontSize: 33.0,
color: Theme.of(context).backgroundColor),
),
]),
);
;
},
isExpanded: item.isExpanded,
body: Container(
child: Text("body"), …Run Code Online (Sandbox Code Playgroud) android ×3
kotlin-js ×2
bottom-sheet ×1
dagger-2 ×1
expansion ×1
flutter ×1
flutter-web ×1
google-maps ×1
okhttp3 ×1
retrofit2 ×1
rx-java2 ×1