简体   繁体   English

在 react-native-device-info 之后 React Native 代码中断

[英]React Native code broke after react-native-device-info

I am working on react native project and trying to fetch Device-info from https://github.com/react-native-device-info/react-native-device-info this library.我正在处理本机项目并尝试从https://github.com/react-native-device-info/react-native-device-info这个库中获取设备信息。 And, the build is failing after this.而且,在此之后构建失败。 Here is my build.gradle looks like:这是我的build.gradle样子:

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:4.0.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
    }
}

在此处输入图像描述

I have tried this solution as well React Native: Get device name through Native Modules without callback But no help.我也尝试过这个解决方案React Native: Get device name through Native Modules without callback但没有帮助。 Can anybody suggest something to fetch device-info from react-native project.任何人都可以建议从 react-native 项目中获取设备信息。 Thanks谢谢

After digging more into the code for 3 days and comparing it with my backup code, I found the solution and it is working well now.在深入研究代码 3 天并将其与我的备份代码进行比较后,我找到了解决方案,并且现在运行良好。

I had "react-native-msal": "^4.0.2", installed for Active Directory authentication.我为 Active Directory 身份验证安装了"react-native-msal": "^4.0.2",

And, react-native-device-info needed lower version of "react-native-msal": "^3.1.1",而且, react-native-device-info需要较低版本的"react-native-msal": "^3.1.1",

So, I downgraded msal to 3.1.1 using following command.因此,我使用以下命令将 msal 降级为 3.1.1。

yarn add react-native-msal@3.1.1

Hope this helps for anybody facing same issue.希望这对面临同样问题的人有所帮助。

Thanks谢谢

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

相关问题 安装 react-native-device-info 错误 android 后 - after install react-native-device-info error android 反应本机 android 未使用 react-native-device-info 编译 - React native android not compiling with react-native-device-info react-native-device-info使Android上的应用程序崩溃 - react-native-device-info crash the app on android 任务':react-native-device-info:processReleaseResources'的执行失败 - Execution failed for task ':react-native-device-info:processReleaseResources' 清单合并失败。 添加并链接react-native-device-info后 - Manifest merger failed. After adding and linking react-native-device-info react-native-device-info 获取 getUniqueID() 不适用于 react native 和 android 中的 expo - react-native-device-info get getUniqueID() not working with react native and expo in android 未定义不是对象(评估“RNDeviceInfo.deviceId”)-react-native-device-info 中的错误 - undefined is not object (evaluating 'RNDeviceInfo.deviceId') - error in react-native-device-info 无法使用 react-native-device-info 的 getIPAddress() 返回 IP 地址 - Unable to return IP address using react-native-device-info's getIPAddress() 反应本机代码更改不反映在设备上 - React native code changes not reflecting on device 是否可以将wifi信息发送到react-native设备 - Is it possible to send wifi info to a device in react-native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM