@@ -10,6 +10,7 @@ Device Information for [React Native](https://github.com/facebook/react-native).
...
@@ -10,6 +10,7 @@ Device Information for [React Native](https://github.com/facebook/react-native).
*[Linking](#linking)
*[Linking](#linking)
*[Usage](#usage)
*[Usage](#usage)
*[API](#api)
*[API](#api)
*[Troubleshooting](#troubleshooting)
*[Release Notes](#release-notes)
*[Release Notes](#release-notes)
## Installation
## Installation
...
@@ -784,6 +785,61 @@ Tells if the device is a tablet.
...
@@ -784,6 +785,61 @@ Tells if the device is a tablet.
constisTablet=DeviceInfo.isTablet();// true
constisTablet=DeviceInfo.isTablet();// true
```
```
## Troubleshooting
When installing or using `react-native-device-info`, you may encounter the following problems:
<details>
<summary>[android] - Unable to merge dex / Multiple dex files</summary>
`react-native-device-info` uses `com.google.android.gms:play-services-gcm` to provide [getInstance()][#getinstance].
This can lead to conflicts when building the Android application.
If you're using a different version of `com.google.android.gms:play-services-gcm` in your app, you can define the
`googlePlayServicesVersion` gradle variable in your `build.gradle` file to tell `react-native-device-info` what version
it should require.
If you're using a different library that conflicts with `com.google.android.gms:play-services-gcm`, you can simply
ignore this dependency in your gradle file:
```
compile(project(':react-native-device-info')) {
exclude group: 'com.google.android.gms'
}
```
</details>
<details>
<summary>[ios] - ld: library not found for -lRNDeviceInfo-tvOS</summary>
Seems to be a bug caused by `react-native link`. You can manually delete `libRNDeviceInfo-tvOS.a` in `Xcode -> [Your iOS build target] -> Build Phrases -> Link Binary with Libraries`.
</details>
<details>
<summary>[tests] - Cannot run my test suite when using this library</summary>
`react-native-device-info` contains native code, and needs to be mocked.
Here's how to do it with jest for example:
```
// in your package.json:
"jest": {
"setupFiles": [
"./testenv.js"
],
// testenv.js:
jest.mock('react-native-device-info', () => {
return {
getModel: jest.fn(),
};
});
```
</details>
## Release Notes
## Release Notes
See the [CHANGELOG.md](https://github.com/rebeccahughes/react-native-device-info/blob/master/CHANGELOG.md).
See the [CHANGELOG.md](https://github.com/rebeccahughes/react-native-device-info/blob/master/CHANGELOG.md).