我使用此https://www.npmjs.com/package/cordova-plugin-calendar cordova / phonegap插件创建活动。事件已创建(我在模拟器中测试过)。但是,单击日历中的事件将始终使日历应用程序崩溃。以下是调试输出。
我试图停止日历应用,然后清除数据,但它没有帮助。当侧载到手机时,日历应用程序根本无法启动。它是日历应用程序的错误,因为从第三方插件写入的数据可以破坏应用程序吗?
以下是我用来创建活动的javascript代码。
$scope.addCalendar = function (title, eventLocation, notes, startDate, endDate) {//, success, error) {
//var success = function (message) { console.log("Success: " + JSON.stringify(message)); };
//var error = function (message) { console.error("Error: " + message); };
//window.plugins.calendar.createCalendar("Test calendar", success, error);
var s = new Date(startDate);
var e = new Date(endDate);
window.plugins.calendar.createEvent(title, eventLocation, notes, s, e,
function (result) { console.log('Event created.'); },
function (err) { console.error("There was an error "+ err); }
); //, success, error);
};
调试输出:
I/ActivityManager( 1500): START u0 {act=android.intent.action.VIEW dat=content://com.android.calendar/events/3 flg=0x20020000 cmp=com.android.calendar/.EventInfoActivity (has extras)} from uid 10018 on display 0 I/InputDispatcher( 1500): Dropping event because there is no touchable window at (869, 499). I/InputDispatcher( 1500): Dropping event because there is no touchable window at (869, 499). I/WebViewFactory( 5558): Loading com.android.webview version 37 (2882263-x86) (code 100007) I/LibraryLoader( 5558): Loading: webviewchromium I/LibraryLoader( 5558): Time to load native libraries: 1 ms (timestamps 5605-5606) I/LibraryLoader( 5558): Expected native library version number "",actual native library version number "" V/WebViewChromiumFactoryProvider( 5558): Binding Chromium to main looper Looper (main, tid 1) {87cf21c} I/LibraryLoader( 5558): Expected native library version number "",actual native library version number "" I/chromium( 5558): [INFO:library_loader_hooks.cc(106)] Chromium logging enabled: level = 0, default verbosity = 0 I/BrowserStartupController( 5558): Initializing chromium process, renderers=0 W/art ( 5558): Attempt to remove local handle scope entry from IRT, ignoring W/chromium( 5558): [WARNING:resource_bundle.cc(315)] locale_file_path.empty() I/chromium( 5558): [INFO:aw_browser_main_parts.cc(63)] Load from apk succesful, fd=42 off=46092 len=2953 I/chromium( 5558): [INFO:aw_browser_main_parts.cc(78)] Loading webviewchromium.pak from, fd:43 off:228796 len:643667 W/AudioManagerAndroid( 5558): Requires BLUETOOTH permission I/InputDispatcher( 1500): Dropping event because there is no touchable window at (869, 499). I/InputDispatcher( 1500): Dropping event because there is no touchable window at (869, 499). I/ActivityManager( 1500): Displayed com.android.calendar/.EventInfoActivity: +251ms E/DatabaseUtils( 2131): Writing exception to parcel E/DatabaseUtils( 2131): java.lang.IllegalArgumentException: the bind value at index 2 is null E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteProgram.bindString(SQLiteProgram.java:164) E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteProgram.bindAllArgsAsStrings(SQLiteProgram.java:200) E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:47) E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1316) E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:400) E/DatabaseUtils( 2131): at android.database.sqlite.SQLiteQueryBuilder.query(SQLiteQueryBuilder.java:333) E/DatabaseUtils( 2131): at com.android.providers.calendar.CalendarProvider2.query(CalendarProvider2.java:1062) E/DatabaseUtils( 2131): at com.android.providers.calendar.CalendarProvider2.queryInternal(CalendarProvider2.java:1033) E/DatabaseUtils( 2131): at com.android.providers.calendar.CalendarProvider2.query(CalendarProvider2.java:839) E/DatabaseUtils( 2131): at android.content.ContentProvider.query(ContentProvider.java:950) E/DatabaseUtils( 2131): at android.content.ContentProvider$Transport.query(ContentProvider.java:210) E/DatabaseUtils( 2131): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:112) E/DatabaseUtils( 2131): at android.os.Binder.execTransact(Binder.java:446) W/AsyncQuery( 5558): java.lang.IllegalArgumentException: the bind value at index 2 is null D/AndroidRuntime( 5558): Shutting down VM E/AndroidRuntime( 5558): FATAL EXCEPTION: main E/AndroidRuntime( 5558): Process: com.android.calendar, PID: 5558 E/AndroidRuntime( 5558): java.lang.NullPointerException: Attempt to invoke interface method 'boolean android.database.Cursor.moveToFirst()' on a null object reference E/AndroidRuntime( 5558): at com.android.calendar.EventInfoFragment$QueryHandler.onQueryComplete(EventInfoFragment.java:536) E/AndroidRuntime( 5558): at com.android.calendar.AsyncQueryService.handleMessage(AsyncQueryService.java:412) E/AndroidRuntime( 5558): at android.os.Handler.dispatchMessage(Handler.java:102) E/AndroidRuntime( 5558): at android.os.Looper.loop(Looper.java:135) E/AndroidRuntime( 5558): at android.app.ActivityThread.main(ActivityThread.java:5221) E/AndroidRuntime( 5558): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 5558): at java.lang.reflect.Method.invoke(Method.java:372) E/AndroidRuntime( 5558): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899) E/AndroidRuntime( 5558): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694) W/ActivityManager( 1500): Force finishing activity com.android.calendar/.EventInfoActivity W/ActivityManager( 1500): Force finishing activity com.android.calendar/.AllInOneActivity D/DropBoxEntryAddedChimeraService( 2216): User is not opted-in to Usage & Diagnostics. I/OpenGLRenderer( 1500): Initialized EGL, version 1.4 W/ActivityManager( 1500): Activity pause timeout for ActivityRecord{308c7753 u0 com.android.calendar/.EventInfoActivity t33 f} I/Process ( 5558): Sending signal. PID: 5558 SIG: 9 W/AudioTrack( 1500): AUDIO_OUTPUT_FLAG_FAST denied by client I/WindowState( 1500): WIN DEATH: Window{251673fd u0 com.android.calendar/com.android.calendar.EventInfoActivity} W/libprocessgroup( 1500): failed to open /acct/uid_10018/pid_5558/cgroup.procs: No such file or directory I/ActivityManager( 1500): Process com.android.calendar (pid 5558) has died I/WindowState( 1500): WIN DEATH: Window{2fede9b6 u0 com.android.calendar/com.android.calendar.AllInOneActivity} W/InputMethodManagerService( 1500): Got RemoteException sending setActive(false) notification to pid 5558 uid 10018