jlcool / aliossflutter

阿里云oss flutter
Apache License 2.0
76 stars 47 forks source link

android 上初始化出现错误 #30

Open gaoyong06 opened 4 years ago

gaoyong06 commented 4 years ago

错误日志如下

W/System.err(20405): android.os.NetworkOnMainThreadException W/System.err(20405): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) W/System.err(20405): at java.net.InetAddress.lookupHostByName(InetAddress.java:418) W/System.err(20405): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) W/System.err(20405): at java.net.InetAddress.getByName(InetAddress.java:305) W/System.err(20405): at com.alibaba.sdk.android.oss.common.utils.OSSUtils.isValidateIP(OSSUtils.java:795) W/System.err(20405): at com.alibaba.sdk.android.oss.OSSImpl.(OSSImpl.java:133) W/System.err(20405): at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:116) W/System.err(20405): at com.jlcool.aliossflutter.AliossflutterPlugin.init(AliossflutterPlugin.java:250) W/System.err(20405): at com.jlcool.aliossflutter.AliossflutterPlugin.onMethodCall(AliossflutterPlugin.java:100) W/System.err(20405): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226) W/System.err(20405): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) W/System.err(20405): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) W/System.err(20405): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(20405): at android.os.MessageQueue.next(MessageQueue.java:143) W/System.err(20405): at android.os.Looper.loop(Looper.java:122) W/System.err(20405): at android.app.ActivityThread.main(ActivityThread.java:5305) W/System.err(20405): at java.lang.reflect.Method.invoke(Native Method) W/System.err(20405): at java.lang.reflect.Method.invoke(Method.java:372) W/System.err(20405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922) W/System.err(20405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:717) W/System.err(20405): android.os.NetworkOnMainThreadException W/System.err(20405): at android.os.StrictMode$AndroidBlockGuardPolicy.onNetwork(StrictMode.java:1147) W/System.err(20405): at java.net.InetAddress.lookupHostByName(InetAddress.java:418) W/System.err(20405): at java.net.InetAddress.getAllByNameImpl(InetAddress.java:252) W/System.err(20405): at java.net.InetAddress.getByName(InetAddress.java:305) W/System.err(20405): at com.alibaba.sdk.android.oss.common.utils.OSSUtils.isValidateIP(OSSUtils.java:795) W/System.err(20405): at com.alibaba.sdk.android.oss.OSSImpl.(OSSImpl.java:133) W/System.err(20405): at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:116) W/System.err(20405): at com.alibaba.sdk.android.oss.OSSClient.(OSSClient.java:104) W/System.err(20405): at com.jlcool.aliossflutter.AliossflutterPlugin.secretInit(AliossflutterPlugin.java:144) W/System.err(20405): at com.jlcool.aliossflutter.AliossflutterPlugin.onMethodCall(AliossflutterPlugin.java:102) W/System.err(20405): at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:226) W/System.err(20405): at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:85) W/System.err(20405): at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:631) W/System.err(20405): at android.os.MessageQueue.nativePollOnce(Native Method) W/System.err(20405): at android.os.MessageQueue.next(MessageQueue.java:143) W/System.err(20405): at android.os.Looper.loop(Looper.java:122) W/System.err(20405): at android.app.ActivityThread.main(ActivityThread.java:5305) W/System.err(20405): at java.lang.reflect.Method.invoke(Native Method) W/System.err(20405): at java.lang.reflect.Method.invoke(Method.java:372) W/System.err(20405): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:922) W/System.err(20405): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:717)


在主线程里访问网络了