Родной модуль в реагирует на родной, не может вызывать «это» в java классе - PullRequest
1 голос
/ 10 апреля 2020

помоги мнеееее ....! В моем реактивном собственном проекте и создан собственный модуль «BeaconModule», чтобы использовать некоторые функции, которые реагируют на родной, не поддерживает. в android проекте все работает нормально. но когда я выполняю функцию AIBeaconManager.init () для реактивного проекта, появляется ошибка ниже.

  • это мой код
public class BeaconModule extends ReactContextBaseJavaModule implements AIBeaconListener{
  private static ReactApplicationContext reactContext;

  BeaconModule(ReactApplicationContext context) {
    super(context);
    reactContext = context;

    Map<String, Object> options = new HashMap<String, Object>() {{
            put(AIBeaconManagerInitOption.Keys.AutoServiceRegistrationEnabled, Boolean.valueOf(true));
            put(AIBeaconManagerInitOption.Keys.PushNotificationEnabled, Boolean.valueOf(true));
        }};
    AIBeaconManager aiBeaconManager = AIBeaconManager.init(this, "1062", "09CYvck2rZVNlpQI", options);
  }
  • ошибка:
Error: Command failed: ./gradlew app:installDebug -PreactNativeDevServerPort=8081
/Users/admin/Documents/Working/GPass/GPass/android/app/src/main/java/com/gpass/BeaconModule.java:57: error: incompatible types: BeaconModule cannot be converted to Context
    AIBeaconManager aiBeaconManager = AIBeaconManager.init(this, "1062", "09CYvck2rZVNlpQI", options); 
                                                           ^
Note: /Users/admin/Documents/Working/GPass/GPass/android/app/src/debug/java/com/gpass/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
1 error

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Я думаю это потому, что разница между 'Context' и 'ReactApplicationContext'

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...