Merge pull request #1626 from vokhuyetOz/update-androidx

Update androidx
This commit is contained in:
Daniel Mariño Ruiz 2019-07-25 10:10:02 +02:00 committed by GitHub
commit 1fb07b53d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 37 deletions

View File

@ -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).
@ -73,8 +74,9 @@ end
</details>
<details>
<summary>tvOS</summary>
### tvOS
<details>
<summary>tvOS details</summary>
`react-native link react-native-video` doesnt work properly with the tvOS target so we need to add the library manually.
@ -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.
@ -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')
@ -130,7 +135,16 @@ dependencies {
}
```
**MainApplication.java**
#### **android/gradle.properties**
Migrating to AndroidX (needs version >= 5.0.0):
```gradle.properties
android.useAndroidX=true
android.enableJetifier=true
```
#### **MainApplication.java**
On top, where imports are:
@ -151,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.
@ -165,7 +180,7 @@ 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:
@ -173,7 +188,7 @@ Add a reference to `ReactNativeVideo` to your main application project. From Vis
* 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
@ -200,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:

View File

@ -28,9 +28,9 @@ dependencies {
}
// All support libs must use the same version
implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "com.android.support:support-compat:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "com.android.support:support-media-compat:${safeExtGet('supportLibVersion', '28.0.0')}"
implementation "androidx.annotation:annotation:1.0.0"
implementation "androidx.core:core:1.0.0"
implementation "androidx.media:media:1.0.0"
implementation('com.google.android.exoplayer:extension-okhttp:2.9.3') {
exclude group: 'com.squareup.okhttp3', module: 'okhttp'

View File

@ -111,7 +111,6 @@ android {
release {
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
matchingFallbacks = ['release', 'debug']
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
@ -132,10 +131,8 @@ android {
dependencies {
implementation project(':react-native-video')
compile "com.android.support:appcompat-v7:28.0.0"
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "androidx.appcompat:appcompat:1.0.0"
implementation "com.facebook.react:react-native:+" // From node_modules
// compile project(':react-native-video-exoplayer') // uncomment to use exoplayer
}
// Run this once to be able to run the application with BUCK

View File

@ -24,8 +24,8 @@ public class MainApplication extends Application implements ReactApplication {
protected List<ReactPackage> getPackages() {
return Arrays.asList(
new MainReactPackage(),
new ReactVideoPackage()
);
new ReactVideoPackage()
);
}
};

View File

@ -24,9 +24,7 @@ buildscript {
allprojects {
repositories {
mavenLocal()
maven {
url 'https://maven.google.com'
}
google()
maven {
url "https://jitpack.io"
}

View File

@ -3,8 +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')
include ':app'

View File

@ -45,11 +45,6 @@
"scripts": {
"test": "node_modules/.bin/eslint *.js"
},
"rnpm": {
"android": {
"sourceDir": "./android-exoplayer"
}
},
"files": [
"android-exoplayer",
"android",