起伏的水
起伏的水
  • 发布:2016-12-05 16:35
  • 更新:2017-01-18 14:11
  • 阅读:1959

Android离线打包上传图片崩溃

分类:5+ SDK

项目有一部分是用mui做的,用webapp的方式集成进去后上传图片时直接就停止运行了,报如下异常:

12-05 16:00:40.630 857-2260/com.afanda.driver W/WebView: java.lang.Throwable: A WebView method was called on thread 'Thread-2017'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 1) {42140b08} called on null, FYI main Looper is Looper (main, tid 1) {42140b08})
at android.webkit.WebView.checkThread(WebView.java:2081)
at android.webkit.WebView.getUrl(WebView.java:1231)
at io.dcloud.common.adapter.ui.AdaWebview.obtainFullUrl(AdaWebview.java:231)
at io.dcloud.feature.pdr.a$b.a(CompressImage.java:224)
at io.dcloud.feature.pdr.a$b.a(CompressImage.java:195)
at io.dcloud.feature.pdr.a.b(CompressImage.java:66)
at io.dcloud.feature.pdr.a$1.run(CompressImage.java:42)
at java.lang.Thread.run(Thread.java:841)
12-05 16:00:40.630 857-2260/com.afanda.driver W/dalvikvm: threadid=55: thread exiting with uncaught exception (group=0x41dfec38)
12-05 16:00:40.640 2601-2613/? W/Parcel: Attempt to read object from Parcel 0x75e112b8 at offset 68 that is not in the object list
12-05 16:00:40.640 2601-2613/? W/System.err: java.lang.NullPointerException
12-05 16:00:40.640 2601-2613/? W/System.err: at android.content.Intent.readFromParcel(Intent.java:7052)
12-05 16:00:40.640 2601-2613/? W/System.err: at android.content.Intent.<init>(Intent.java:7032)
12-05 16:00:40.640 2601-2613/? W/System.err: at android.content.Intent$1.createFromParcel(Intent.java:7023)
12-05 16:00:40.640 2601-2613/? W/System.err: at android.content.Intent$1.createFromParcel(Intent.java:7021)
12-05 16:00:40.640 2601-2613/? W/System.err: at tcs.awf$c.b(SourceFile:160)
12-05 16:00:40.640 2601-2613/? W/System.err: at tcs.awf$c.c(SourceFile:178)
12-05 16:00:40.640 2601-2613/? W/System.err: at com.tencent.permissionfw.permission.adapter.special.a$f.a(SourceFile:460)
12-05 16:00:40.640 2601-2613/? W/System.err: at com.tencent.permissionfw.permission.a.a(SourceFile:153)
12-05 16:00:40.640 2601-2613/? W/System.err: at com.tencent.permissionfw.permission.a.a(SourceFile:272)
12-05 16:00:40.640 2601-2613/? W/System.err: at tcs.awt$a.onTransact(SourceFile:127)
12-05 16:00:40.640 2601-2613/? W/System.err: at android.os.Binder.execTransact(Binder.java:404)
12-05 16:00:40.640 2601-2613/? W/System.err: at dalvik.system.NativeStart.run(Native Method)

上传图片的代码如下

function upload(url, options, files, data, callbackFun) {
var task = plus.uploader.createUpload(url,
options,
function(t, status) {
//callbackFun(t, status);
console.log(status);
console.log(t.responseText);
}
);
for(var i = 0; i < files.length; i++) {
var name = "file" + i;
task.addFile(files[i], {
key: name
});
}
for(var i = 0; i < data.length; i++) {
task.addData(data[i].name, data[i].value);
}
task.start();
}

导包如下:
compile files('libs/barcode.jar')
compile files('libs/camera.jar')
compile files('libs/contacts.jar')
compile files('libs/device.jar')
compile files('libs/downloader.jar')
compile files('libs/file.jar')
compile files('libs/gallery.jar')
compile files('libs/json_simple-1.1.jar')
compile files('libs/nativeObj.jar')
compile files('libs/nativeui.jar')
compile files('libs/navigatorui.jar')
compile files('libs/pdr.jar')
compile files('libs/ui.jar')
compile files('libs/uploader.jar')
compile files('libs/xhr.jar')
compile files('libs/nopermission.jar')
compile files('libs/invocation.jar')
compile files('libs/aps-dhPush.jar')
compile files('libs/aps-igexin.jar')
compile files('libs/aps.jar')
compile files('libs/statistics-umeng.jar')
compile files('libs/geolocation.jar')
compile files('libs/geolocation-system.jar')
compile files('libs/messaging.jar')
compile files('libs/sensor.jar')
compile files('libs/Msc.jar')
compile files('libs/ninenineoldandroids-2.4.0.jar')
compile files('libs/universal-image-loader-1.9.0.jar')

有谁遇到过类似问题吗?项目是用Android studio写的,求大神帮忙!

2016-12-05 16:35 负责人:无 分享
已邀请:
1***@qq.com

1***@qq.com

耗时操作在子线程,更新UI或者js交互最好统一在主线程中。4.2以下不会这种报错

该问题目前已经被锁定, 无法添加新回复