React Native code broke after react-native-device-info

1.2k Views Asked by At

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. And, the build is failing after this. Here is my build.gradle looks like:

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' }
    }
}

enter image description here

I have tried this solution as well React Native: Get device name through Native Modules without callback But no help. Can anybody suggest something to fetch device-info from react-native project. Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

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.

I had "react-native-msal": "^4.0.2", installed for Active Directory authentication.

And, react-native-device-info needed lower version of "react-native-msal": "^3.1.1",

So, I downgraded msal to 3.1.1 using following command.

yarn add [email protected]

Hope this helps for anybody facing same issue.

Thanks