Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails because Logger symbol is not found #134

Closed
lb-ovc opened this issue Sep 24, 2024 · 16 comments · Fixed by #130
Closed

Build fails because Logger symbol is not found #134

lb-ovc opened this issue Sep 24, 2024 · 16 comments · Fixed by #130

Comments

@lb-ovc
Copy link

lb-ovc commented Sep 24, 2024

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
Copy link
Author

lb-ovc commented Sep 24, 2024

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

@robingenz
Copy link
Member

Thank you. I created a fix: #130 🙌

@lb-ovc
Copy link
Author

lb-ovc commented Sep 24, 2024

Thank you. I created a fix: #130 🙌

Cool thank you for fixing it that quick 🫶

@lb-ovc
Copy link
Author

lb-ovc commented Sep 24, 2024

@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
Copy link
Member

@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

@lb-ovc
Copy link
Author

lb-ovc commented Sep 24, 2024

@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
Copy link
Author

lb-ovc commented Sep 24, 2024

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

@robingenz
Copy link
Member

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:

// @TODO: we might want to throw an error somehow

@robingenz
Copy link
Member

@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
Copy link
Author

lb-ovc commented Sep 24, 2024

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:

// @TODO: we might want to throw an error somehow

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
Copy link
Member

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
Copy link
Author

lb-ovc commented Sep 24, 2024

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
Copy link

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

@lb-ovc
Copy link
Author

lb-ovc commented Sep 30, 2024

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
Copy link

.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
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants