android - React native firebase - android无法构建

标签 android firebase react-native push-notification

由于某种原因,我无法构建我的项目。昨天一切正常,看着 https://firebase.google.com/support/release-notes/android#update_-_april_02_2019 21 年 5 月 11 日有一个重要更新。
我尝试按照建议更改 minSdkVersion,但仍然没有解决方案。
这是错误:

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:39: error: cannot find symbol
import com.google.firebase.iid.FirebaseInstanceId;
                              ^
  symbol:   class FirebaseInstanceId
  location: package com.google.firebase.iid
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:40: error: cannot find symbol
import com.google.firebase.iid.InstanceIdResult;
                              ^
  symbol:   class InstanceIdResult
  location: package com.google.firebase.iid
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:143: error: cannot find symbol
              .addOnCompleteListener(new OnCompleteListener<InstanceIdResult>() {
                                                            ^
  symbol:   class InstanceIdResult
  location: class RNPushNotification
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:145: error: cannot find symbol
                  public void onComplete(@NonNull Task<InstanceIdResult> task) {
                                                       ^
  symbol: class InstanceIdResult
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:142: error: cannot find symbol
      FirebaseInstanceId.getInstance().getInstanceId()
      ^
  symbol:   variable FirebaseInstanceId
  location: class RNPushNotification
C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java:289: error: cannot find symbol
                  FirebaseInstanceId.getInstance().deleteInstanceId();
                  ^
  symbol: variable FirebaseInstanceId
Note: C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotificationHelper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: C:\Users\Gilad\SaveLatestJoyRide-FE\joyride-fe\node_modules\react-native-push-notification\android\src\main\java\com\dieam\reactnativepushnotification\modules\RNPushNotification.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
6 errors

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-push-notification:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
请帮忙! :(

最佳答案

只需在 android/build.gradle 下添加以下内容

buildscript {
    ext {
    .....
    firebaseMessagingVersion = "21.1.0"
}

关于android - React native firebase - android无法构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67502473/

相关文章:

android - 我如何获得 Activity ?

android - 如何通过代码将xml图层列表转换为layerdrawable

公众无法访问 Firebase Cloud Function [应用程序正在请求访问您的 Google 帐户的权限。]

javascript - react native react-native-sqlite-storage不返回结果

react-native - 我如何在 native react 中获取路线参数

android - RelativeLayout 在膨胀时不遵守设置的宽度

android - 分区表无效或损坏

android - 在 Firebase 9.0.0 API 中,如何检查用户是否具有有效的 Auth session ?

javascript - Firebase 登录不提示

javascript - React Native 如何在同一个动画事件中传递两个事件?