Skip to content

Commit

Permalink
docs: add troubleshooting section
Browse files Browse the repository at this point in the history
  • Loading branch information
machour committed Feb 23, 2018
1 parent c9b2a47 commit 5daad48
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Device Information for [React Native](https://github.com/facebook/react-native).
* [Linking](#linking)
* [Usage](#usage)
* [API](#api)
* [Troubleshooting](#troubleshooting)
* [Release Notes](#release-notes)

## Installation
Expand Down Expand Up @@ -784,6 +785,61 @@ Tells if the device is a tablet.
const isTablet = 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
See the [CHANGELOG.md](https://github.com/rebeccahughes/react-native-device-info/blob/master/CHANGELOG.md).

0 comments on commit 5daad48

Please sign in to comment.