I'm installing MoEngage sdk and react-native-moengage
packages on my react native app, but I have been unable so far to run the app even after following the guide in the official site
Removing everything related to moengage makes the app run again, so I don't believe it's a different package or bad config
I tried cleaning gradle, running from CLI, running from android studio, running in a physical device, changing the versions of appcompat (breaking other things, so I'd rather not do that again)... Up to no avail.
Currently running:
Windows 10 64bits
React native 0.59.8. It's not a new app, it started in 0.55.4 and migrated to 0.59.8 over time.
Gradle build tools 3.3.0 and gradle version 4.10.1-all
// app/build.gradle
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
...
}
...
dependencies {
implementation project(':react-native-moengage')
implementation 'com.moengage:moe-android-sdk:+'
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "com.android.support:appcompat-v7:28.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
...
}
// settings.gradle
include ':react-native-moengage'
project(':react-native-moengage').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-moengage/android')
//MainApplication.java
...
import com.moengage.react.MoEReactPackage;
...
public class MainApplication extends Application implements ReactApplication {
...
@Override
public boolean getUseDeveloperSupport() {
return BuildConfig.DEBUG;
}
@Override
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new MoEReactPackage(),
);
}
};
@Override
public void onCreate() {
super.onCreate();
MoEngage moEngage =
new MoEngage.Builder(this, "XXX")
.build();
MoEngage.initialise(moEngage);
}
So far I've only gotten the following message
...project\android\app\src\main\java\io\lifevision\MainApplication.java:95: error: cannot find symbol
MoEngage moEngage =
^
symbol: class MoEngage
location: class MainApplication
...project\android\app\src\main\java\io\lifevision\MainApplication.java:96: error: package MoEngage does not exist
new MoEngage.Builder(this, "UZXYFJ0V2RQRUFJTMVHOAJKC")
^
...project\android\app\src\main\java\io\lifevision\MainApplication.java:98: error: cannot find symbol
MoEngage.initialise(moEngage);
^
symbol: variable MoEngage
location: class MainApplication
3 errors
Import statement for MoEngage.java is missing. Below is the required import statement
import com.moengage.core.MoEngage;
I would recommend you to enable auto-import in your IDE(Android Studio) it will help you manage the imports.
Let me if this does not solve your issue. Alternatively you can write to us at [email protected]