Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update androidx #1626

Merged
merged 8 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 25 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,15 @@ yarn add react-native-video

Then follow the instructions for your platform to link react-native-video into your project:

### iOS
<details>
<summary>iOS</summary>
<summary>iOS details</summary>

### Standard Method
#### Standard Method

Run `react-native link react-native-video` to link the react-native-video library.

### Using CocoaPods (required to enable caching)
#### Using CocoaPods (required to enable caching)

Setup your Podfile like it is described in the [react-native documentation](https://facebook.github.io/react-native/docs/integration-with-existing-apps#configuring-cocoapods-dependencies).

Expand All @@ -73,8 +74,9 @@ end

</details>

<details>
<summary>tvOS</summary>
### tvOS
<details>
<summary>tvOS details</summary>

`react-native link react-native-video` doesn’t work properly with the tvOS target so we need to add the library manually.

Expand All @@ -95,14 +97,15 @@ Select RCTVideo-tvOS
<img src="./docs/tvOS-step-4.jpg" width="40%">
</details>

### Android
<details>
<summary>Android</summary>
<summary>Android details</summary>

Run `react-native link react-native-video` to link the react-native-video library.

Or if you have trouble, make the following additions to the given files manually:

**android/settings.gradle**
#### **android/settings.gradle**

The newer ExoPlayer library will work for most people.

Expand All @@ -119,9 +122,11 @@ project(':react-native-video').projectDir = new File(rootProject.projectDir, '..
```


**android/app/build.gradle**
#### **android/app/build.gradle**

```gradle
From version >= 5.0.0, you have to apply this changes:

```diff
dependencies {
...
compile project(':react-native-video')
Expand All @@ -130,16 +135,16 @@ dependencies {

}
```
**android/gradle.properties**
#### **android/gradle.properties**

Migrating to AndroidX:
Migrating to AndroidX (needs version >= 5.0.0):

```gradle.properties
android.useAndroidX=true
android.enableJetifier=true
```

**MainApplication.java**
#### **MainApplication.java**

On top, where imports are:

Expand All @@ -160,12 +165,13 @@ protected List<ReactPackage> getPackages() {
```
</details>

### Windows
<details>
<summary>Windows</summary>
<summary>Windows details</summary>

Make the following additions to the given files manually:

**windows/myapp.sln**
#### **windows/myapp.sln**

Add the `ReactNativeVideo` project to your solution.

Expand All @@ -174,15 +180,15 @@ Add the `ReactNativeVideo` project to your solution.
* UWP: Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj`
* WPF: Select `node_modules\react-native-video\windows\ReactNativeVideo.Net46\ReactNativeVideo.Net46.csproj`

**windows/myapp/myapp.csproj**
#### **windows/myapp/myapp.csproj**

Add a reference to `ReactNativeVideo` to your main application project. From Visual Studio 2015:

1. Right-click main application project > Add > Reference...
* UWP: Check `ReactNativeVideo` from Solution Projects.
* WPF: Check `ReactNativeVideo.Net46` from Solution Projects.

**MainPage.cs**
#### **MainPage.cs**

Add the `ReactVideoPackage` class to your list of exported packages.
```cs
Expand All @@ -209,12 +215,13 @@ using System.Collections.Generic;
```
</details>

### react-native-dom
<details>
<summary>react-native-dom</summary>
<summary>react-native-dom details</summary>

Make the following additions to the given files manually:

**dom/bootstrap.js**
#### **dom/bootstrap.js**

Import RCTVideoManager and add it to the list of nativeModules:

Expand Down
11 changes: 4 additions & 7 deletions examples/basic/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,16 @@ def enableSeparateBuildPerCPUArchitecture = false
def enableProguardInReleaseBuilds = false

android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.videoplayer"
minSdkVersion 16
targetSdkVersion 28
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
ndk {
Expand Down Expand Up @@ -132,11 +132,8 @@ android {

dependencies {
implementation project(':react-native-video')
// compile "com.android.support:appcompat-v7:25.2.0"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
// implementation project(':react-native-video')
// compile project(':react-native-video-exoplayer') // uncomment to use exoplayer
}

// Run this once to be able to run the application with BUCK
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ public boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new ReactVideoPackage()
);
new ReactVideoPackage()
);
}
};

Expand Down
4 changes: 1 addition & 3 deletions examples/basic/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven {
url 'https://maven.google.com'
}
google()
maven {
url "https://jitpack.io"
}
Expand Down
6 changes: 0 additions & 6 deletions examples/basic/android/settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,4 @@ rootProject.name = 'VideoPlayer'
include ':react-native-video'
project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer')

// Quick Local Development
//project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../android')
//project(':react-native-video-exoplayer').projectDir = new File(rootProject.projectDir, '../../android-exoplayer')

// project(':react-native-video').projectDir = new File(rootProject.projectDir, '../../android')
// project(':react-native-video-exoplayer').projectDir = new File(rootProject.projectDir, '../../android-exoplayer')
include ':app'
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,6 @@
"scripts": {
"test": "node_modules/.bin/eslint *.js"
},
"rnpm": {
"android": {
"sourceDir": "./android-exoplayer"
}
},
"files": [
"android-exoplayer",
"android",
Expand Down