软件包com.geektime.rnonesignalandroid不存在

时间:2019-11-16 23:36:00

标签: android react-native onesignal react-native-onesignal

我正在尝试为我的本机项目设置onesignal。我使用npm进行安装。但是,当我尝试通过react-native run-android在android模拟器上运行时,出现了此错误。

> 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

我的MainApplication.java文件;

    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;

在build.gradle文件的顶部,我添加了此代码块。

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'

我试图在MainApplication.java上将导入com.geektime.rnonesignalandroid.ReactNativeOneSignalPackage更改为import com.geektime.reactnativeonesignal.ReactNativeOneSignalPackage,但是没有解决。

0 个答案:

没有答案