[英]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.