How do I install required dependencies for a custom React Native NativeModule for Java with gradle?

18 Views Asked by At

So I am trying to build a WearOS companion app for my React Native app. I am using, as a guide, an example project provided on Medium.com; the link follows: https://medium.com/@bevkoski/establishing-communication-between-react-native-and-android-wear-apps-1c8fd7bd5704

Everything in terms of building the custom NativeModule, the "why" it needs to be this way makes sense to me, and the "how" it is going to work makes sense to me. The problem I am having is: I simply can not get the needed dependencies to install and/or be made available in the ReactContextBaseJavaModule class. Specifically, I can not get this thing to resolve the following:

//import android.support.annotation.Nullable;
//import com.google.android.gms.common.api.GoogleApiClient;
//import com.google.android.gms.wearable.MessageApi;
//import com.google.android.gms.wearable.MessageEvent;
//import com.google.android.gms.wearable.Node;
//import com.google.android.gms.wearable.Wearable;

Inside my build.gradle file for the Android app itself, I've added such things as:

implementation("androidx.annotation:annotation:1.7.1")
implementation("com.google.android.gms:play-services-wearable:18.1.0")
implementation("com.google.android.gms:play-services-all-wear:15.0.1")
implementation("com.google.android.gms:play-services-base:18.3.0")

... in various ways. Logically, to me, the above should give me, at least, some of the classes I need in the previous section, but all of them remain unresolvable. Please, what am I doing wrong?

--Edit--

It may be worth noting that I do have solid 2-way communication between Android and React Native using my ReactContextBaseJavaModule implementation.

Additionally, my WearOS project is in Kotlin, and while it was a pain, I was able to properly configure its dependencies and can send a message to my phone app; I just do not have anything to listen or respond to it.

0

There are 0 best solutions below