vonovak / react-native-add-calendar-event

Create, view or edit events in react native using the standard iOS / Android dialogs
MIT License
344 stars 103 forks source link

Crashing on Android #152

Open julestruong opened 2 years ago

julestruong commented 2 years ago

When calling

  try {
      const eventConfig: AddCalendarEvent.CreateOptions = {
        title: 'test',
        startDate: dayjs().startOf('hour').toISOString(),
        endDate: dayjs().startOf('hour').add(1, 'hour').toISOString(),
        location: 'Rayon',
        // and other options
      }
      const result = await AddCalendarEvent.presentEventCreatingDialog(
        eventConfig,
      )
      if (result.action === 'SAVED') {
        const { calendarItemIdentifier, eventIdentifier } = result

        console.log(calendarItemIdentifier, eventIdentifier)
      } else {
        console.log('Canceled')
      }
    } catch (error) {
      console.log('WHAT')
      console.log(error)
    }

The error :

java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.android.calendar/com.android.calendar.event.EditEventActivity}: java.lang.ClassNotFoundException: Didn't find class "com.android.calendar.event.EditEventActivity" on path: DexPathList[[zip file "/product/app/Calendar/Calendar.apk"],nativeLibraryDirectories=[/product/app/Calendar/lib/x86, /system/lib, /system_ext/lib]]
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3365)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
        at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
        at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
        at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
        at android.os.Handler.dispatchMessage(Handler.java:106)
        at android.os.Looper.loop(Looper.java:223)
        at android.app.ActivityThread.main(ActivityThread.java:7656)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)

Version "react-native-add-calendar-event": "4.0.0", Simulator : Pixel 5

catcher23 commented 2 years ago

running into the same issue. @julestruong did you find a way to resolve this? @vonovak any ideas?

grkemtneri commented 1 year ago

did you find any solution ? @catcher23

gamertense commented 5 months ago

Can you try setting the library to v4.2.2? It works for me both on iOS and Android if I stick with this version.

The app crashes when I use v5.0.0. I didn't check native console, but I think it's the same root cause.

makedirectory commented 1 month ago

Can you try setting the library to v4.2.2? It works for me both on iOS and Android if I stick with this version.

The app crashes when I use v5.0.0. I didn't check native console, but I think it's the same root cause.

Only works here when set to v4.2.2 on Android.

ehteshamtrimulabs commented 1 month ago

On the latest version, you need to ask for both read and write permissions for calendar.

https://github.com/vonovak/react-native-add-calendar-event/issues/185#issuecomment-2197274707