我想上传图片。以前,它一切正常。突然间现在它停止在Android上工作。在iOS上测试相同的代码,工作正常。应用程序崩溃,从画廊 - 钛的Android
使用案例: 点击一个按钮 - 打开相机(或可从库中选择) 2.捕获的图像 3.按“确定”按钮 - 应用程序崩溃
我清理大量内存认为有些设备可能有内存问题。根据新的发行说明添加摄像头权限,仍然面临问题。这里是我的代码:
var dialog = Ti.UI.createOptionDialog({
options : ['Camera', 'Gallery', 'Cancel'],
title : 'Upload image using?'
});
dialog.show();
dialog.addEventListener('click', function(e) {
if (e.index === 0) {
//Open Camera
Ti.Media.showCamera({
saveToPhotoGallery : true,
success : function(event) {
console.error('UPLOAD IMAGE SUCCESS ', JSON.stringify(event));
callback(event.media);
},
cancel : function(err) {
console.error('UPLOAD IMAGE CANCEL ', JSON.stringify(err));
},
error : function(err) {
console.error('UPLOAD IMAGE ERROR ', JSON.stringify(err));
},
showControls : true,
mediaTypes : Ti.Media.MEDIA_TYPE_PHOTO,
autohide : true
});
} else if (e.index === 1) {
//Open gallery
Ti.Media.openPhotoGallery({
success : function(event) {
console.error('UPLOAD IMAGE SUCCESS ', JSON.stringify(event));
callback(event.media);
},
cancel : function(err) {
console.error('UPLOAD IMAGE CANCEL ', JSON.stringify(err));
},
error : function(err) {
console.error('UPLOAD IMAGE ERROR ', JSON.stringify(err));
},
});
} else {
// Do nothing
}
dialog.hide();
});
tiapp.xml
<manifest>
<uses-permission android:name="android.permission.CAMERA" />
</manifest>
谁能告诉什么是错的代码或是否需要添加其他内容?
一些日志:
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : skia: --- SkImageDecoder::Factory returned null
[DEBUG] : Window: Window is closed normally.
logcat的请留言。 –
您可以发布您的logcat .. –
而崩溃,我没有得到任何调试日志。 – Porwal