简体   繁体   English

反应原生 firebase - android 无法构建

[英]React native firebase - android not able to build

For some reason I am unable to build my project.由于某种原因,我无法构建我的项目。 Yesterday everything worked fine, looking at https://firebase.google.com/support/release-notes/android#update_-_april_02_2019 there is a critical update from 5/11/21.昨天一切正常,查看https://firebase.google.com/support/release-notes/android#update_-_april_02_2019有一个从 5/11/21 开始的重要更新。

I tried to change the minSdkVersion as suggested but still no resolution.我尝试按照建议更改 minSdkVersion,但仍然没有解决方案。

This is the error:这是错误:

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.

Please help: :(请帮忙: :(

just add the following under android/build.gradle只需在 android/build.gradle 下添加以下内容

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

I faced this issue recently, and resolving this is pretty easy.我最近遇到了这个问题,解决这个问题很容易。 you would need to upgrade your native-push-notification.您需要升级您的本机推送通知。 I suggest you change this in your package.json as so native-push-notification version to ^7.3.0.我建议您在 package.json 中将其更改为 ^7.3.0。 this worked for me.这对我有用。 Iho[e this helps. Iho[e 这有帮助。

I have resolved this issue by adding this line in my android gradle file.我已经通过在我的 android gradle 文件中添加此行来解决此问题。

firebaseMessagingVersion = "21.1.0" firebaseMessagingVersion = "21.1.0"

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM