I'm trying to setup onesignal for my react native project. I used npm for install. But when i try to run on android emulator via react-native run-android
, it gaves this error.
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
53 actionable tasks: 2 executed, 51 up-to-date
/Users/comp/Desktop/MyApp/android/app/src/main/java/com/myapp/MainApplication.java:10: error: package com.geektime.rnonesignalandroid does not exist
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
^
/Users/comp/Desktop/MyApp/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:21: error: package com.geektime.rnonesignalandroid does not exist
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
^
/Users/comp/Desktop/MyApp/android/app/build/generated/rncli/src/main/java/com/facebook/react/PackageList.java:61: error: cannot find symbol
new ReactNativeOneSignalPackage(),
^
symbol: class ReactNativeOneSignalPackage
location: class PackageList
3 errors
My MainApplication.java file;
package com.myapp;
import android.app.Application;
import android.util.Log;
import com.facebook.react.PackageList;
import com.facebook.hermes.reactexecutor.HermesExecutorFactory;
import com.facebook.react.bridge.JavaScriptExecutorFactory;
import com.facebook.react.ReactApplication;
import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.soloader.SoLoader;
At the top of my build.gradle file i added this code block.
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' } // Gradle Plugin Portal
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.1, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
I tried to change import com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage
to import com.geektime.reactnativeonesignal.ReactNativeOneSignalPackage
on MainApplication.java but didn't work out.