capacitor-community / contacts

Contacts Plugin for Capacitor
https://capacitor-community.github.io/contacts/
124 stars 54 forks source link

Build fails because Logger symbol is not found #134

Closed lb-ovc closed 1 month ago

lb-ovc commented 1 month ago

Bug Description When attempting to start the simulator or build the project on an Android device, the build fails with the following error:

cannot find symbol
        Logger.error(TAG, message, exception);
        ^
  symbol:   variable Logger
  location: class ContactsPlugin

To Reproduce Steps to reproduce the behavior:

  1. Install package version 6.1.0
  2. Build and sync the project for Android.
  3. Launch the app in the simulator or on a phone.
  4. Build fails

Screenshots If applicable, add screenshots to help explain your problem. image

Additional context We applied a temporary fix by using a patch file to remove the problematic line.

lb-ovc commented 1 month ago

@robingenz as we talked about it in discord heres the bug report

robingenz commented 1 month ago

Thank you. I created a fix: https://github.com/capacitor-community/contacts/pull/130 🙌

lb-ovc commented 1 month ago

Thank you. I created a fix: #130 🙌

Cool thank you for fixing it that quick 🫶

lb-ovc commented 1 month ago

@robingenz

Im not sure if this will fix it. Just added the import into our coding here and it still gives an error:

error: cannot find symbol
        Logger.error(TAG, message, exception);
                     ^
  symbol:   variable TAG
  location: class ContactsPlugin
robingenz commented 1 month ago

@lb-ovc Does this help? 06dd334 (#130)

I'm currently having problems with my local setup and can't build this one plugin. I don't know why yet. That's why I created this PR: https://github.com/capacitor-community/contacts/pull/131

lb-ovc commented 1 month ago

@lb-ovc Does this help? 06dd334 (#130)

I'm currently having problems with my local setup and can't build this one plugin. I don't know why yet. That's why I created this PR: #131

Yes this solved those issues. While testing with different images we encountered that the createContact fails sometimes. I was able to narrow it down to the image.

Not sure why it happens tho.

image The minified react error is: https://react.dev/errors/31?invariant=31&args%5B%5D=%5Bobject%20Error%5D

Im not sure why that error would occure in the first place because we do not use the reponse of the createContact method any further.

sadly the error message is not very good and just says something went wrong: image

lb-ovc commented 1 month ago

We will remove the image prop for now and add it later when the new feature is properly tested and fixed

robingenz commented 1 month ago

Yes this solved those issues. While testing with different images we encountered that the createContact fails sometimes. I was able to narrow it down to the image.

That's strange. It works for me 100% of the time.

sadly the error message is not very good and just says something went wrong:

You must print the error in this line: https://github.com/capacitor-community/contacts/blob/ec880ff4cdeded783d4f8f5fe7bf5ac6c920a415/android/src/main/java/getcapacitor/community/contacts/Contacts.java#L347

robingenz commented 1 month ago

@lb-ovc I just tested my implementation again using the following dev build and everything worked without issues:

npm i @capacitor-community/contacts@6.1.0-dev.852577c.1727177586

Feel free to create a separate issue with some more details about your problem and i will take a look.

lb-ovc commented 1 month ago

Yes this solved those issues. While testing with different images we encountered that the createContact fails sometimes. I was able to narrow it down to the image.

That's strange. It works for me 100% of the time.

sadly the error message is not very good and just says something went wrong:

You must print the error in this line:

https://github.com/capacitor-community/contacts/blob/ec880ff4cdeded783d4f8f5fe7bf5ac6c920a415/android/src/main/java/getcapacitor/community/contacts/Contacts.java#L347

I was able to log the error:

 android.os.TransactionTooLargeException: data parcel size 1995156 bytes
                                                                                                        at android.os.BinderProxy.transactNative(Native Method)
                                                                                                        at android.os.BinderProxy.transact(BinderProxy.java:584)
                                                                                                        at android.content.ContentProviderProxy.applyBatch(ContentProviderNative.java:635)
                                                                                                        at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:574)
                                                                                                        at android.content.ContentProviderClient.applyBatch(ContentProviderClient.java:562)
                                                                                                        at android.content.ContentResolver.applyBatch(ContentResolver.java:2256)
                                                                                                        at getcapacitor.community.contacts.Contacts.createContact(Contacts.java:337)
                                                                                                        at getcapacitor.community.contacts.ContactsPlugin.createContact(ContactsPlugin.java:165)
                                                                                                        at java.lang.reflect.Method.invoke(Native Method)
                                                                                                        at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:138)
                                                                                                        at com.getcapacitor.Bridge.lambda$callPluginMethod$0(Bridge.java:821)
                                                                                                        at com.getcapacitor.Bridge.$r8$lambda$FNYM7cvgeBk0k8YXQH7M96Mrf-c(Unknown Source:0)
                                                                                                        at com.getcapacitor.Bridge$$ExternalSyntheticLambda0.run(D8$$SyntheticClass:0)
                                                                                                        at android.os.Handler.handleCallback(Handler.java:958)
                                                                                                        at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                        at android.os.Looper.loopOnce(Looper.java:205)
                                                                                                        at android.os.Looper.loop(Looper.java:294)
                                                                                                        at android.os.HandlerThread.run(HandlerThread.java:67)
robingenz commented 1 month ago

I guess that means your image (base64 string) is too big. We should throw this error so that we can handle it in the WebView. Please create a separate issue for that. As a workaround, I recommend compressing your image before you call the createContact() method.

lb-ovc commented 1 month ago

I guess that means your image (base64 string) is too big. We should throw this error so that we can handle it in the WebView. Please create a separate issue for that. As a workaround, I recommend compressing your image before you call the createContact() method.

Yeah, the image has 2mb.

Will create the issue later that evening. We will be implementing this in the next sprint then.

dliver-more commented 1 month ago

Getting the same issue here when attempting to build.

Screenshot 2024-09-30 at 2 48 33 PM
lb-ovc commented 1 month ago

Getting the same issue here when attempting to build. Screenshot 2024-09-30 at 2 48 33 PM

yeah same problem.. PR is not merged yet so we need to wait for that for now. Consider making a patch file to add the missing import and TAG for now

khamaileon commented 1 month ago
.pnpm/@capacitor-community+contacts@6.1.0_@capacitor+core@6.1.2/node_modules/@capacitor-community/contacts/android/src/main/java/getcapacitor/community/contacts/ContactsPlugin.java:249: error: cannot find symbol
        Logger.error(TAG, message, exception);
        ^
        symbol:   variable Logger
        location: class ContactsPlugin
        2 errors

Same issue here. The last release don't work on Android.

dliver-more commented 1 month ago

@lb-ovc I just tested my implementation again using the following dev build and everything worked without issues:

npm i @capacitor-community/contacts@6.1.0-dev.852577c.1727177586

Feel free to create a separate issue with some more details about your problem and i will take a look.

I used this version and it's building correctly now. Hopefully it will be incorporated soon.