capacitor-community / contacts

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

build output error #79

Closed arvinthvikas closed 1 year ago

arvinthvikas commented 1 year ago

i used this code in my angular project then i convert my project into capacitor then i use this npm and run code in android studio then adroid throws error error: cannot find symbol this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{ ^ symbol: method init(Bundle,<anonymous ArrayList<Class<? extends Plugin>>>)

my java main activity code is package flycard.app; import ch.byrds.capacitor.contacts.Contacts; import android.os.Bundle;

import com.getcapacitor.BridgeActivity; import com.getcapacitor.Plugin; import java.util.ArrayList;

public class MainActivity extends BridgeActivity { @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); // Initializes the Bridge this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{ // Additional plugins you've installed go here // Ex: add(TotallyAwesomePlugin.class); add(Contacts.class); }}); } }

tafelnl commented 1 year ago

This seems like a common error that is caused by forgetting to run npx cap sync and/or forgetting to run Gradle sync. I have added it to the documentation as well: https://capacitor-community.github.io/contacts/#/guide/troubleshooting

I will close this issue now, but please re-open if you still encounter this error. If you do so, could you please provide more information. Ideally you would provide us with a minimal reproduction repo.


On a side note:

A new major of this plugin just got released as a beta version. The plugin is refactored quite a bit. Among others, the API and TypeScript definitions got improved.

Check out the newly added docs here: https://capacitor-community.github.io/contacts

Mind you that the new version (v3 and v4) are currently still in beta. However, the beta is tested quite extensively and fairly stable. If you're willing to test it out in your project, it would be much appreciated!