aws-amplify / amplify-android

The fastest and easiest way to use AWS from your Android app.
https://docs.amplify.aws/lib/q/platform/android/
Apache License 2.0
247 stars 117 forks source link

[Flutter] `ClassNotFoundException: boolean` on app start #997

Closed fjnoyp closed 3 years ago

fjnoyp commented 3 years ago

If you save a model with a boolean field, when you close and reopen the app and perform a query, the following error is shown several times. The app is still functional.

W/amplify:aws-datastore( 4745): java.lang.RuntimeException: DataStoreException{message=Error in querying the model., cause=com.google.gson.JsonSyntaxException: java.io.IOException: java.lang.ClassNotFoundException: boolean, recoverySuggestion=See attached exception for details.}

Our Dart save code uses the following values on the ModelField:

targetType javaClassForValue value type in Kotlin
Boolean Boolean::class.java boolean ?
jamesonwilliams commented 3 years ago

@fjnoyp Can you please include a code snippet to repro this, including the data you're passing to the Android library, the Kotlin ModelSchema you're using? Also, logs / full stack trace.

fjnoyp commented 3 years ago

The logs are very repetitive, it keeps saying boolean cannot be found. Here's a snippet starting from the beginning:

--------- beginning of system
2020-11-25 13:26:58.117 615-2438/system_process I/ActivityManager: Force stopping com.amazonaws.amplify.amplify_datastore_example appid=10169 user=0: from pid 6863
2020-11-25 13:26:58.121 6863-6865/? I/cmd: oneway function results will be dropped but finished with status OK and parcel size 4
2020-11-25 13:26:58.130 918-918/com.android.phone D/CarrierSvcBindHelper: No carrier app for: 0
2020-11-25 13:26:58.160 615-2438/system_process I/ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.amazonaws.amplify.amplify_datastore_example/.MainActivity} from uid 2000
2020-11-25 13:26:58.161 615-636/system_process W/EventSequenceValidator: IntentStarted during UNKNOWN. Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.amazonaws.amplify.amplify_datastore_example/.MainActivity }
    java.lang.Throwable: EventSequenceValidator#getStackTrace
        at com.google.android.startop.iorap.EventSequenceValidator.logWarningWithStackTrace(EventSequenceValidator.java:260)
        at com.google.android.startop.iorap.EventSequenceValidator.onIntentStarted(EventSequenceValidator.java:106)
        at com.android.server.wm.LaunchObserverRegistryImpl.handleOnIntentStarted(LaunchObserverRegistryImpl.java:139)
        at com.android.server.wm.LaunchObserverRegistryImpl.lambda$veRn_GhgLZLlOHOJ0ZYT6KcfYqo(Unknown Source:0)
        at com.android.server.wm.-$$Lambda$LaunchObserverRegistryImpl$veRn_GhgLZLlOHOJ0ZYT6KcfYqo.accept(Unknown Source:10)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:292)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
        at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.os.HandlerThread.run(HandlerThread.java:67)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2020-11-25 13:26:58.162 615-636/system_process I/EventSequenceValidator: inc AccIntentStartedEvents to 2
2020-11-25 13:26:58.165 502-913/? D/iorapd: EventManager: Looking up compiled trace done in 1ms.
2020-11-25 13:26:58.165 502-913/? D/iorapd: Cannot find compiled trace in sqlite for package_name: com.amazonaws.amplify.amplify_datastore_example activity_name: com.amazonaws.amplify.amplify_datastore_example.MainActivity
2020-11-25 13:26:58.165 502-913/? D/iorapd: Prebuilt compiled trace doesn't exists. file_path: /product/iorap-trace/com.amazonaws.amplify.amplify_datastore_example.compiled_trace.pb
2020-11-25 13:26:58.169 502-6874/? D/iorapd: Create Perfetto handle 8
2020-11-25 13:26:58.172 502-6876/? D/iorapd: PerfettoConsumer::StartTracing(handle=8)
2020-11-25 13:26:58.172 493-493/? I/perfetto: ing_service_impl.cc:756 Configured tracing session 8, #sources:1, duration:5000 ms, #buffers:1, total buffer size:4096 KB, total sessions:1, uid:1071 session name: ""
2020-11-25 13:26:58.173 502-1624/? D/iorapd: PerfettoConsumerImpl::Looper result was -1
2020-11-25 13:26:58.174 483-483/? I/perfetto: probes_producer.cc:230  Ftrace setup (target_buf=8)
2020-11-25 13:26:58.179 6869-6871/? I/cmd: oneway function results will be dropped but finished with status OK and parcel size 4
2020-11-25 13:26:58.194 615-636/system_process D/CompatibilityChangeReporter: Compat change id reported: 135634846; UID 10169; state: DISABLED
2020-11-25 13:26:58.196 615-643/system_process D/CompatibilityChangeReporter: Compat change id reported: 143937733; UID 10169; state: DISABLED
2020-11-25 13:26:58.197 615-636/system_process W/EventSequenceValidator: onActivityLaunched during UNKNOWN.
    java.lang.Throwable: EventSequenceValidator#getStackTrace
        at com.google.android.startop.iorap.EventSequenceValidator.logWarningWithStackTrace(EventSequenceValidator.java:260)
        at com.google.android.startop.iorap.EventSequenceValidator.onActivityLaunched(EventSequenceValidator.java:149)
        at com.android.server.wm.LaunchObserverRegistryImpl.handleOnActivityLaunched(LaunchObserverRegistryImpl.java:157)
        at com.android.server.wm.LaunchObserverRegistryImpl.lambda$UGY1OclnLIQLMEL9B55qjERFf4o(Unknown Source:0)
        at com.android.server.wm.-$$Lambda$LaunchObserverRegistryImpl$UGY1OclnLIQLMEL9B55qjERFf4o.accept(Unknown Source:10)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:292)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
        at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.os.HandlerThread.run(HandlerThread.java:67)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2020-11-25 13:26:58.197 502-913/? D/iorapd: EventManager: Looking up compiled trace done in 0ms.
2020-11-25 13:26:58.197 502-913/? D/iorapd: Cannot find compiled trace in sqlite for package_name: com.amazonaws.amplify.amplify_datastore_example activity_name: com.amazonaws.amplify.amplify_datastore_example.MainActivity
2020-11-25 13:26:58.197 502-913/? D/iorapd: Prebuilt compiled trace doesn't exists. file_path: /product/iorap-trace/com.amazonaws.amplify.amplify_datastore_example.compiled_trace.pb
2020-11-25 13:26:58.216 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x925680
2020-11-25 13:26:58.216 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fcb57000 size 0x927000
2020-11-25 13:26:58.283 483-483/? I/perfetto: ftrace_procfs.cc:176    enabled ftrace
2020-11-25 13:26:58.267 0-0/? W/perfetto: enabled ftrace
2020-11-25 13:26:58.314 398-398/? D/Zygote: Forked child process 6877
2020-11-25 13:26:58.328 615-643/system_process W/ActivityManager: Slow operation: 135ms so far, now at startProcess: returned from zygote!
2020-11-25 13:26:58.329 615-643/system_process W/ActivityManager: Slow operation: 136ms so far, now at startProcess: done updating battery stats
2020-11-25 13:26:58.329 615-643/system_process W/ActivityManager: Slow operation: 136ms so far, now at startProcess: building log message
2020-11-25 13:26:58.329 615-643/system_process I/ActivityManager: Start proc 6877:com.amazonaws.amplify.amplify_datastore_example/u0a169 for pre-top-activity {com.amazonaws.amplify.amplify_datastore_example/com.amazonaws.amplify.amplify_datastore_example.MainActivity}
2020-11-25 13:26:58.330 615-643/system_process W/ActivityManager: Slow operation: 136ms so far, now at startProcess: starting to update pids map
2020-11-25 13:26:58.330 615-643/system_process W/ActivityManager: Slow operation: 136ms so far, now at startProcess: done updating pids map
2020-11-25 13:26:58.331 6877-6877/? I/tastore_exampl: Not late-enabling -Xcheck:jni (already on)
2020-11-25 13:26:58.356 6877-6877/? I/tastore_exampl: Unquickening 12 vdex files!
2020-11-25 13:26:58.360 6877-6877/? W/tastore_exampl: Unexpected CPU variant for X86 using defaults: x86
2020-11-25 13:26:58.372 478-517/? I/adbd: jdwp connection from 6877
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_3 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_7 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_11 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_9 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_10 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_6 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_4 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.398 615-908/system_process W/InputReader: Device virtio_input_multi_touch_5 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.399 615-908/system_process W/InputReader: Device virtio_input_multi_touch_3 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.399 615-908/system_process W/InputReader: Device virtio_input_multi_touch_7 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.399 615-908/system_process W/InputReader: Device virtio_input_multi_touch_11 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.399 615-908/system_process W/InputReader: Device virtio_input_multi_touch_2 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_8 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_9 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_10 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_6 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_4 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.400 615-908/system_process W/InputReader: Device virtio_input_multi_touch_5 is associated with display ADISPLAY_ID_NONE.
2020-11-25 13:26:58.431 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/tastore_exampl: The ClassLoaderContext is a special shared library.
2020-11-25 13:26:58.436 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/tastore_exampl: The ClassLoaderContext is a special shared library.
2020-11-25 13:26:58.679 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-11-25 13:26:58.680 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/NetworkSecurityConfig: No Network Security Config specified, using platform default
2020-11-25 13:26:58.682 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/MultiDex: VM with version 2.1.0 has multidex support
2020-11-25 13:26:58.682 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/MultiDex: Installing application
2020-11-25 13:26:58.682 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/MultiDex: VM has multidex support, MultiDex support library is disabled.
2020-11-25 13:26:58.699 6877-6901/com.amazonaws.amplify.amplify_datastore_example D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so
2020-11-25 13:26:58.703 6877-6901/com.amazonaws.amplify.amplify_datastore_example D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so
2020-11-25 13:26:58.706 6877-6901/com.amazonaws.amplify.amplify_datastore_example D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so
2020-11-25 13:26:58.749 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/System.out: should load native is true
2020-11-25 13:26:58.758 6877-6903/com.amazonaws.amplify.amplify_datastore_example I/ResourceExtractor: Found extracted resources res_timestamp-1-1606339442628
2020-11-25 13:26:58.829 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostConnection::get() New Host Connection established 0xf0956210, tid 6877
2020-11-25 13:26:58.843 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
2020-11-25 13:26:58.848 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglCreateContext: 0xf075f810: maj 3 min 0 rcv 3
2020-11-25 13:26:58.849 6877-6877/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglCreateContext: 0xf075ed90: maj 3 min 0 rcv 3
2020-11-25 13:26:58.852 6877-6907/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostConnection::get() New Host Connection established 0xf09559d0, tid 6907
2020-11-25 13:26:58.863 6877-6907/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
2020-11-25 13:26:58.864 6877-6907/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglMakeCurrent: 0xf075ed90: ver 3 0 (tinfo 0xf0aba050) (first time)
2020-11-25 13:26:58.933 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/Amplify Flutter: Added Core plugin
2020-11-25 13:26:58.950 6877-6877/com.amazonaws.amplify.amplify_datastore_example I/amplify:flutter:datastore: Initiated DataStore plugin
2020-11-25 13:26:58.976 6877-6877/com.amazonaws.amplify.amplify_datastore_example W/tastore_exampl: Accessing hidden method Landroid/view/accessibility/AccessibilityNodeInfo;->getSourceNodeId()J (greylist,test-api, reflection, allowed)
2020-11-25 13:26:58.976 6877-6877/com.amazonaws.amplify.amplify_datastore_example W/tastore_exampl: Accessing hidden method Landroid/view/accessibility/AccessibilityRecord;->getSourceNodeId()J (greylist, reflection, allowed)
2020-11-25 13:26:58.976 6877-6877/com.amazonaws.amplify.amplify_datastore_example W/tastore_exampl: Accessing hidden field Landroid/view/accessibility/AccessibilityNodeInfo;->mChildNodeIds:Landroid/util/LongArray; (greylist, reflection, allowed)
2020-11-25 13:26:58.976 6877-6877/com.amazonaws.amplify.amplify_datastore_example W/tastore_exampl: Accessing hidden method Landroid/util/LongArray;->get(I)J (greylist, reflection, allowed)
2020-11-25 13:26:59.019 6877-6917/com.amazonaws.amplify.amplify_datastore_example I/flutter: Observatory listening on http://127.0.0.1:46721/U5yLxSLy3M0=/
2020-11-25 13:26:59.039 6877-6899/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostConnection::get() New Host Connection established 0xf0952850, tid 6899
2020-11-25 13:26:59.061 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x89a300
2020-11-25 13:26:59.061 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3f9486000 size 0x89c000
2020-11-25 13:26:59.067 281-281/? I/hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.mapper@4.0::IMapper/default in either framework or device manifest.
2020-11-25 13:26:59.068 6877-6906/com.amazonaws.amplify.amplify_datastore_example I/Gralloc4: mapper 4.x is not supported
2020-11-25 13:26:59.075 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: createUnique: call
2020-11-25 13:26:59.077 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostConnection::get() New Host Connection established 0xf0953450, tid 6906
2020-11-25 13:26:59.077 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/eglCodecCommon: allocate: Ask for block of size 0x100
2020-11-25 13:26:59.078 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fdafc000 size 0x2000
2020-11-25 13:26:59.086 6877-6899/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
2020-11-25 13:26:59.086 6877-6899/com.amazonaws.amplify.amplify_datastore_example W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without...
2020-11-25 13:26:59.087 6877-6899/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglCreateContext: 0xf0766f10: maj 3 min 0 rcv 3
2020-11-25 13:26:59.090 6877-6899/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglMakeCurrent: 0xf0766f10: ver 3 0 (tinfo 0xf0abba30) (first time)
2020-11-25 13:26:59.101 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x925680
2020-11-25 13:26:59.102 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fc230000 size 0x927000
2020-11-25 13:26:59.109 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
2020-11-25 13:26:59.113 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostConnection::get() New Host Connection established 0xf0953930, tid 6906
2020-11-25 13:26:59.129 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/HostConnection: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_native_sync_v4 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_YUV_Cache ANDROID_EMU_async_unmap_buffer GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_0 
2020-11-25 13:26:59.130 6877-6906/com.amazonaws.amplify.amplify_datastore_example D/EGL_emulation: eglMakeCurrent: 0xf075f810: ver 3 0 (tinfo 0xf0aba730) (first time)
2020-11-25 13:26:59.315 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x925680
2020-11-25 13:26:59.315 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3f8238000 size 0x927000
2020-11-25 13:26:59.329 615-641/system_process I/ActivityTaskManager: Displayed com.amazonaws.amplify.amplify_datastore_example/.MainActivity: +1s167ms
2020-11-25 13:26:59.330 615-636/system_process W/EventSequenceValidator: onActivityLaunchFinished during UNKNOWN.
    java.lang.Throwable: EventSequenceValidator#getStackTrace
        at com.google.android.startop.iorap.EventSequenceValidator.logWarningWithStackTrace(EventSequenceValidator.java:260)
        at com.google.android.startop.iorap.EventSequenceValidator.onActivityLaunchFinished(EventSequenceValidator.java:185)
        at com.android.server.wm.LaunchObserverRegistryImpl.handleOnActivityLaunchFinished(LaunchObserverRegistryImpl.java:175)
        at com.android.server.wm.LaunchObserverRegistryImpl.lambda$QcawcFcJtEX4EhYptq_Vb4j368Y(Unknown Source:0)
        at com.android.server.wm.-$$Lambda$LaunchObserverRegistryImpl$QcawcFcJtEX4EhYptq_Vb4j368Y.accept(Unknown Source:10)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:292)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
        at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.os.HandlerThread.run(HandlerThread.java:67)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2020-11-25 13:26:59.330 615-636/system_process I/EventSequenceValidator: dec AccIntentStartedEvents to 1
2020-11-25 13:26:59.331 615-690/system_process W/InputDispatcher: channel 'e182c2b Splash Screen com.amazonaws.amplify.amplify_datastore_example (server)' ~ Consumer closed input channel or an error occurred.  events=0x9
2020-11-25 13:26:59.331 615-690/system_process E/InputDispatcher: channel 'e182c2b Splash Screen com.amazonaws.amplify.amplify_datastore_example (server)' ~ Channel is unrecoverably broken and will be disposed!
2020-11-25 13:26:59.333 615-637/system_process W/InputDispatcher: Attempted to unregister already unregistered input channel 'e182c2b Splash Screen com.amazonaws.amplify.amplify_datastore_example (server)'
2020-11-25 13:26:59.337 1109-1109/com.google.android.apps.nexuslauncher D/TaplEvents: Main / Activity.onStop
2020-11-25 13:26:59.363 1455-6636/com.google.android.googlequicksearchbox I/PBSessionCacheImpl: Deleted sessionId[6400763992977314] from persistence.
2020-11-25 13:26:59.383 1455-2018/com.google.android.googlequicksearchbox W/SearchServiceCore: Abort, client detached.
2020-11-25 13:26:59.386 1455-2018/com.google.android.googlequicksearchbox I/MicroDetectionState: Should stop hotword detection immediately - false
2020-11-25 13:26:59.678 6877-6905/com.amazonaws.amplify.amplify_datastore_example I/flutter:  DateTime: 2020-11-25T13:26:59-08:00
2020-11-25 13:26:59.678 6877-6905/com.amazonaws.amplify.amplify_datastore_example I/flutter:  Date: 2020-11-25
2020-11-25 13:26:59.678 6877-6905/com.amazonaws.amplify.amplify_datastore_example I/flutter:  Time: 13:26:59-08:00
2020-11-25 13:27:00.010 788-788/com.android.systemui D/KeyguardClockSwitch: Updating clock: 127
2020-11-25 13:27:00.861 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x89a300
2020-11-25 13:27:00.861 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3f8bea000 size 0x89c000
2020-11-25 13:27:00.919 615-641/system_process I/ActivityTaskManager: Fully drawn com.amazonaws.amplify.amplify_datastore_example/.MainActivity: +2s759ms
2020-11-25 13:27:00.919 6877-6929/com.amazonaws.amplify.amplify_datastore_example I/amplify:aws-datastore: DataStore orchestrator transitioning states. Current mode = STOPPED, target mode = LOCAL_ONLY.
2020-11-25 13:27:00.920 6877-6929/com.amazonaws.amplify.amplify_datastore_example I/amplify:aws-datastore: Starting to observe local storage changes.
2020-11-25 13:27:00.920 502-913/? D/iorapd: Update kReportFullyDrawn for history_id:316 timestamp_ns: 8126698930494
2020-11-25 13:27:00.921 615-636/system_process W/EventSequenceValidator: onReportFullyDrawn during UNKNOWN.
    java.lang.Throwable: EventSequenceValidator#getStackTrace
        at com.google.android.startop.iorap.EventSequenceValidator.logWarningWithStackTrace(EventSequenceValidator.java:260)
        at com.google.android.startop.iorap.EventSequenceValidator.onReportFullyDrawn(EventSequenceValidator.java:205)
        at com.android.server.wm.LaunchObserverRegistryImpl.handleOnReportFullyDrawn(LaunchObserverRegistryImpl.java:184)
        at com.android.server.wm.LaunchObserverRegistryImpl.lambda$FhvLqBbd_XMsJK45WV5Mlt8JSYM(Unknown Source:0)
        at com.android.server.wm.-$$Lambda$LaunchObserverRegistryImpl$FhvLqBbd_XMsJK45WV5Mlt8JSYM.accept(Unknown Source:10)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.doInvoke(PooledLambdaImpl.java:292)
        at com.android.internal.util.function.pooled.PooledLambdaImpl.invoke(PooledLambdaImpl.java:201)
        at com.android.internal.util.function.pooled.OmniFunction.run(OmniFunction.java:97)
        at android.os.Handler.handleCallback(Handler.java:938)
        at android.os.Handler.dispatchMessage(Handler.java:99)
        at android.os.Looper.loop(Looper.java:223)
        at android.os.HandlerThread.run(HandlerThread.java:67)
        at com.android.server.ServiceThread.run(ServiceThread.java:44)
2020-11-25 13:27:00.921 6877-6898/com.amazonaws.amplify.amplify_datastore_example I/tastore_exampl: Waiting for a blocking GC ProfileSaver
2020-11-25 13:27:00.930 414-414/? D/eglCodecCommon: allocate: Ask for block of size 0x925680
2020-11-25 13:27:00.931 414-414/? D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3fcb57000 size 0x927000
2020-11-25 13:27:00.965 6877-6929/com.amazonaws.amplify.amplify_datastore_example W/amplify:aws-datastore: Failed to start observing storage changes.
    java.lang.RuntimeException: DataStoreException{message=Error in querying the model., cause=com.google.gson.JsonSyntaxException: java.io.IOException: java.lang.ClassNotFoundException: boolean, recoverySuggestion=See attached exception for details.}
        at io.reactivex.rxjava3.internal.util.ExceptionHelper.wrapOrThrow(ExceptionHelper.java:46)
        at io.reactivex.rxjava3.internal.observers.BlockingMultiObserver.blockingAwait(BlockingMultiObserver.java:145)
        at io.reactivex.rxjava3.core.Completable.blockingAwait(Completable.java:1490)
        at com.amplifyframework.datastore.syncengine.Orchestrator.startObservingStorageChanges(Orchestrator.java:317)
        at com.amplifyframework.datastore.syncengine.Orchestrator.transitionToLocalOnly(Orchestrator.java:281)
        at com.amplifyframework.datastore.syncengine.Orchestrator.transitionCompletable(Orchestrator.java:230)
        at com.amplifyframework.datastore.syncengine.Orchestrator.start(Orchestrator.java:175)
        at com.amplifyframework.datastore.AWSDataStorePlugin.lambda$start$9$AWSDataStorePlugin(AWSDataStorePlugin.java:259)
        at com.amplifyframework.datastore.-$$Lambda$AWSDataStorePlugin$Xplf__6KLL33tAlYpHwMRfoC4ys.call(Unknown Source:6)
        at com.amplifyframework.datastore.-$$Lambda$bfTiKmvh49Maerv2UH6qjrvdoVg.run(Unknown Source:2)
        at io.reactivex.rxjava3.internal.observers.CallbackCompletableObserver.onComplete(CallbackCompletableObserver.java:53)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.onComplete(CompletableSubscribeOn.java:79)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableTimeout$TimeOutObserver.onComplete(CompletableTimeout.java:87)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate$Emitter.onComplete(CompletableCreate.java:65)
        at com.amplifyframework.datastore.AWSDataStorePlugin.lambda$waitForInitialization$7$AWSDataStorePlugin(AWSDataStorePlugin.java:241)
        at com.amplifyframework.datastore.-$$Lambda$AWSDataStorePlugin$wRMoViRsWlif_MLLrerQABKx-YM.subscribe(Unknown Source:2)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableCreate.subscribeActual(CompletableCreate.java:40)
        at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableTimeout.subscribeActual(CompletableTimeout.java:53)
        at io.reactivex.rxjava3.core.Completable.subscribe(Completable.java:2850)
        at io.reactivex.rxjava3.internal.operators.completable.CompletableSubscribeOn$SubscribeOnObserver.run(CompletableSubscribeOn.java:64)
        at io.reactivex.rxjava3.core.Scheduler$DisposeTask.run(Scheduler.java:614)
        at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:65)
        at io.reactivex.rxjava3.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:56)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:923)
     Caused by: DataStoreException{message=Error in querying the model., cause=com.google.gson.JsonSyntaxException: java.io.IOException: java.lang.ClassNotFoundException: boolean, recoverySuggestion=See attached exception for details.}
        at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$query$4$SQLiteStorageAdapter(SQLiteStorageAdapter.java:384)
        at com.amplifyframework.datastore.storage.sqlite.-$$Lambda$SQLiteStorageAdapter$rGner20-W7t2tJu4yCrrZwlquWE.run(Unknown Source:10)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:462)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) 
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) 
        at java.lang.Thread.run(Thread.java:923) 
     Caused by: com.google.gson.JsonSyntaxException: java.io.IOException: java.lang.ClassNotFoundException: boolean
2020-11-25 13:27:00.972 6877-6929/com.amazonaws.amplify.amplify_datastore_example W/amplify:aws-datastore:     at com.google.gson.Gson.fromJson(Gson.java:947)
        at com.google.gson.Gson.fromJson(Gson.java:897)
        at com.google.gson.Gson.fromJson(Gson.java:846)
        at com.amplifyframework.datastore.syncengine.GsonPendingMutationConverter.fromRecord(GsonPendingMutationConverter.java:72)
        at com.amplifyframework.datastore.syncengine.PersistentMutationOutbox.lambda$null$8$PersistentMutationOutbox(PersistentMutationOutbox.java:186)
        at com.amplifyframework.datastore.syncengine.-$$Lambda$PersistentMutationOutbox$dpdcP5jV9rjnUcXGhUnS4wXfWkY.accept(Unknown Source:6)
        at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$query$4$SQLiteStorageAdapter(SQLiteStorageAdapter.java:382)
            ... 6 more
     Caused by: java.io.IOException: java.lang.ClassNotFoundException: boolean
        at com.amplifyframework.core.model.types.GsonJavaTypeAdapters$ClassTypeAdapterFactory$ClassTypeAdapter.read(GsonJavaTypeAdapters.java:108)
        at com.amplifyframework.core.model.types.GsonJavaTypeAdapters$ClassTypeAdapterFactory$ClassTypeAdapter.read(GsonJavaTypeAdapters.java:88)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:41)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:187)
        at com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter.read(MapTypeAdapterFactory.java:145)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
        at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
        at com.google.gson.Gson.fromJson(Gson.java:932)
            ... 12 more
     Caused by: java.lang.ClassNotFoundException: boolean
        at java.lang.Class.classForName(Native Method)
        at java.lang.Class.forName(Class.java:454)
        at java.lang.Class.forName(Class.java:379)
        at com.amplifyframework.core.model.types.GsonJavaTypeAdapters$ClassTypeAdapterFactory$ClassTypeAdapter.read(GsonJavaTypeAdapters.java:106)
            ... 23 more
     Caused by: java.lang.ClassNotFoundException: Didn't find class "boolean" on path: DexPathList[[zip file "/data/app/~~PMsm8fiN7y3KCzZC70-sQg==/com.amazonaws.amplify.amplify_datastore_example-C0Ck_8MVGq8iL-PWCCHplg==/base.apk"],nativeLibraryDirectories=[/data/app/~~PMsm8fiN7y3KCzZC70-sQg==/com.amazonaws.amplify.amplify_datastore_example-C0Ck_8MVGq8iL-PWCCHplg==/lib/x86, /data/app/~~PMsm8fiN7y3KCzZC70-sQg==/com.amazonaws.amplify.amplify_datastore_example-C0Ck_8MVGq8iL-PWCCHplg==/base.apk!/lib/x86, /system/lib, /system_ext/lib, /product/lib]]
        at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:207)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:379)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
            ... 27 more
fjnoyp commented 3 years ago

This is our schema:

enum TestEnum { 
  yes,
  no,
  maybe
}

type AllTypeModel @model { 
  id: ID!
  stringType: String!
  intType: Int!
  floatType: Float!
  boolType: Boolean!
  dateType: AWSDate!
  dateTimeType: AWSDateTime!
  timeType: AWSTime!
  timestampType: AWSTimestamp!
  enumType: TestEnum 
}
fjnoyp commented 3 years ago

This happens after saving the model. Even if we don't call any queries on app startup the logs shown above complaining about class not found boolean is still shown ...

@jamesonwilliams please let us know if you need anything else.

fjnoyp commented 3 years ago

This is the model that's saved (according to the logs from Amplify Android):

I/amplify:flutter:datastore( 6463): Saved item: SerializedModel{id='2200573c-71f4-4c3d-9af5-93ce08a6f369', serializedData={floatType=123.0, dateType=null, stringType=some string, intType=1000, enumType=maybe, timeType=null, timestampType=null, id=2200573c-71f4-4c3d-9af5-93ce08a6f369, boolType=true, dateTimeType=null}, modelSchema=ModelSchema{name='AllTypeModel', pluralName='AllTypeModels', authRules=[], fields={boolType=ModelField{name='boolType', type='boolean', targetType='Boolean', isRequired=false, isArray=false, isEnum=false, isModel=false}, dateTimeType=ModelField{name='dateTimeType', type='class com.amplifyframework.core.model.temporal.Temporal$DateTime', targetType='AWSDateTime', isRequired=false, isArray=false, isEnum=false, isModel=false}, dateType=ModelField{name='dateType', type='class com.amplifyframework.core.model.temporal.Temporal$Date', targetType='AWSDate', isRequired=false, isArray=false, isEnum=false, isModel=false}, enumType=ModelField{name='enumType', type='class java.lang.String', targetType='String', isRequired=false, isArray=false, isEnum=false, isModel=false}, floatType=ModelField{name='floatType', type='double', targetType='Double', isRequired=false, isArray=false, isEnum=false, isModel=false}, id=ModelField{name='id', type='class java.lang.String', targetType='String', isRequired=true, isArray=false, isEnum=false, isModel=false}, intType=ModelField{name='intType', type='class java.lang.Integer', targetType='Integer', isRequired=false, isArray=false, isEnum=false, isModel=false}, stringType=ModelField{name='stringType', type='class java.lang.String', targetType='String', isRequired=false, isArray=false, isEnum=false, isModel=false}, timeType=ModelField{name='timeType', type='class com.amplifyframework.core.model.temporal.Temporal$Time', targetType='AWSTime', isRequired=false, isArray=false, isEnum=false, isModel=false}, timestampType=ModelField{name='timestampType', type='class com.amplifyframework.core.model.temporal.Temporal$Timestamp', targetType='AWSTimestamp', isRequired=false, isArray=false, isEnum=false, isModel=false}}, associations={}, indexes={}, modelClass=class com.amplifyframework.datastore.appsync.SerializedModel}}

jamesonwilliams commented 3 years ago

Note to self: it looks like the ClassTypeAdapter is reading a lower-case boolean when it wants to read java.lang.Boolean. Todo: why?

com.amplifyframework.core.model.types.GsonJavaTypeAdapters$ClassTypeAdapterFactory$ClassTypeAdapter.read(GsonJavaTypeAdapters.java:106)

Note to self no. 2: the boolean value is saving correctly, and the app is not crashing. This is strange behavior that we should look into because it spams the logs, but as a lower priority. This might worry customers and increase the operational load.

jamesonwilliams commented 3 years ago

@fjnoyp In your ModelSchema dump, I see a mix of primitives and Number types:

Are you doing anything different for the java.lang.Integer, as compared to the double & boolean? I think if you can get those to show as java.lang.Boolean and java.lang.Double, this issue will go away.

fjnoyp commented 3 years ago

Hi @jamesonwilliams I assume "type" is in reference to the ModelField's "javaClassForValue" builder field.

javaClassForValue expects a java class type. Here are the different types of java types we pass. We're passing a "::class.java" for every single type so I'm not too sure what we should do to get the ModelSchema system to have boolean show up as java.lang.Boolean ...

        "string" -> String::class.java
        "int" -> Integer::class.java
        "double" -> Double::class.java
        "date" -> Temporal.Date::class.java
        "dateTime" -> Temporal.DateTime::class.java
        "time" -> Temporal.Time::class.java
        "timestamp" -> Temporal.Timestamp::class.java
        "bool" -> Boolean::class.java
        "enumeration" -> String::class.java
        "model" -> Model::class.java
        "collection" -> List::class.java

We consistently send a java class for each of the different types. My assumption for why the ModelSchema dump would show it differently is because "boolean" and "double" are primitive data types so they aren't technically classes right? While I think Java autoboxing and the requirements of Amplify Android ModelSchema use an actual java class type "java.lang.Integer" and "java.langString".

I believe our previous issue with integer before was because we were sending "java.lang.int" originally. (ie. we were giving Int::class.java instead of Integer::class.java)

jamesonwilliams commented 3 years ago

Hi @jamesonwilliams I assume "type" is in reference to the ModelField's "javaClassForValue" builder field.

Ah yup, the toString() didn't get updated when we change the field name. You are correct that it should say javaClassForValue. #1006 fixes the label in the toString().

javaClassForValue expects a java class type. Here are the different types of java types we pass. We're passing a "::class.java" for every single type so I'm not too sure what we should do to get the ModelSchema system to have boolean show up as java.lang.Boolean ...

        "string" -> String::class.java
        "int" -> Integer::class.java
        "double" -> Double::class.java
        "date" -> Temporal.Date::class.java
        "dateTime" -> Temporal.DateTime::class.java
        "time" -> Temporal.Time::class.java
        "timestamp" -> Temporal.Timestamp::class.java
        "bool" -> Boolean::class.java
        "enumeration" -> String::class.java
        "model" -> Model::class.java
        "collection" -> List::class.java

This all looks good to me, too.

We consistently send a java class for each of the different types. My assumption for why the ModelSchema dump would show it differently is because "boolean" and "double" are primitive data types so they aren't technically classes right? While I think Java autoboxing and the requirements of Amplify Android ModelSchema use an actual java class type "java.lang.Integer" and "java.langString".

Totally.

I believe our previous issue with integer before was because we were sending "java.lang.int" originally. (ie. we were giving Int::class.java instead of Integer::class.java)

Understood. Hm. Yea, I'm not sure why we're getting the primitive types here, in this case. In the worst case, I can just add some logic to deserialize the primitives, too. That wouldn't be the end of the world. I guess I'll do that.