Capacitor Plugin Android Dependencies

How can I add an Android build dependency to my custom capacitor plugin for app rate based on

It fails the build with not finding com.google.android.play.core so I wonder how can I add it as a dependency to the component build?
Below is the error

/AppRate.java:9: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewInfo;
                                          ^
/AppRate.java:10: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewManager;
                                          ^
/AppRate.java:11: error: package com.google.android.play.core.review does not exist
import com.google.android.play.core.review.ReviewManagerFactory;
                                          ^
/AppRate.java:12: error: package com.google.android.play.core.tasks does not exist
import com.google.android.play.core.tasks.Task;
                                         ^
/AppRate.java:17: error: class AppRate clashes with package of same name
public class AppRate extends Plugin {

       ^
/AppRate/BuildConfig.java:4: error: package me.url.AppRate clashes with class of same name
package me.url.AppRate;
^
/AppRate.java:21: error: cannot find symbol
        Activity activity = this.cordova.getActivity();

I am also not sure about the clash error, but that is a separate topic I guess.

Note - I tried integrating the ionic native plugins but had weird build issues. iOS now works with my custom plugin, fixing Android now.

You have to add the dependency in the plugin’s build.gradle

1 Like