Merge pull request #1626 from vokhuyetOz/update-androidx
Update androidx
This commit is contained in:
		
							
								
								
									
										48
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										48
									
								
								README.md
									
									
									
									
									
								
							| @@ -42,14 +42,15 @@ yarn add react-native-video | |||||||
|  |  | ||||||
| Then follow the instructions for your platform to link react-native-video into your project: | Then follow the instructions for your platform to link react-native-video into your project: | ||||||
|  |  | ||||||
|  | ### iOS | ||||||
| <details> | <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. | 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).  | 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> | ||||||
|  |  | ||||||
| <details> | ### tvOS | ||||||
|   <summary>tvOS</summary> |   <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. | `react-native link react-native-video` doesn’t 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%"> | <img src="./docs/tvOS-step-4.jpg" width="40%"> | ||||||
| </details> | </details> | ||||||
|  |  | ||||||
|  | ### Android | ||||||
| <details> | <details> | ||||||
|   <summary>Android</summary> |   <summary>Android details</summary> | ||||||
|  |  | ||||||
| Run `react-native link react-native-video` to link the react-native-video library. | 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: | 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. | 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 { | dependencies { | ||||||
|    ... |    ... | ||||||
|     compile project(':react-native-video') |     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: | On top, where imports are: | ||||||
|  |  | ||||||
| @@ -151,12 +165,13 @@ protected List<ReactPackage> getPackages() { | |||||||
| ``` | ``` | ||||||
| </details> | </details> | ||||||
|  |  | ||||||
|  | ### Windows | ||||||
| <details> | <details> | ||||||
|   <summary>Windows</summary> |   <summary>Windows details</summary> | ||||||
|  |  | ||||||
| Make the following additions to the given files manually: | Make the following additions to the given files manually: | ||||||
|  |  | ||||||
| **windows/myapp.sln** | #### **windows/myapp.sln** | ||||||
|  |  | ||||||
| Add the `ReactNativeVideo` project to your solution. | 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` |   * UWP: Select `node_modules\react-native-video\windows\ReactNativeVideo\ReactNativeVideo.csproj` | ||||||
|   * WPF: Select `node_modules\react-native-video\windows\ReactNativeVideo.Net46\ReactNativeVideo.Net46.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: | 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. |   * UWP: Check `ReactNativeVideo` from Solution Projects. | ||||||
|   * WPF: Check `ReactNativeVideo.Net46` from Solution Projects. |   * WPF: Check `ReactNativeVideo.Net46` from Solution Projects. | ||||||
|  |  | ||||||
| **MainPage.cs** | #### **MainPage.cs** | ||||||
|  |  | ||||||
| Add the `ReactVideoPackage` class to your list of exported packages. | Add the `ReactVideoPackage` class to your list of exported packages. | ||||||
| ```cs | ```cs | ||||||
| @@ -200,12 +215,13 @@ using System.Collections.Generic; | |||||||
| ``` | ``` | ||||||
| </details> | </details> | ||||||
|  |  | ||||||
|  | ### react-native-dom | ||||||
| <details> | <details> | ||||||
|   <summary>react-native-dom</summary> |   <summary>react-native-dom details</summary> | ||||||
|  |  | ||||||
| Make the following additions to the given files manually: | 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: | Import RCTVideoManager and add it to the list of nativeModules: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,9 +28,9 @@ dependencies { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     // All support libs must use the same version |     // All support libs must use the same version | ||||||
|     implementation "com.android.support:support-annotations:${safeExtGet('supportLibVersion', '28.0.0')}" |     implementation "androidx.annotation:annotation:1.0.0" | ||||||
|     implementation "com.android.support:support-compat:${safeExtGet('supportLibVersion', '28.0.0')}" |     implementation "androidx.core:core:1.0.0" | ||||||
|     implementation "com.android.support:support-media-compat:${safeExtGet('supportLibVersion', '28.0.0')}" |     implementation "androidx.media:media:1.0.0" | ||||||
|  |  | ||||||
|     implementation('com.google.android.exoplayer:extension-okhttp:2.9.3') { |     implementation('com.google.android.exoplayer:extension-okhttp:2.9.3') { | ||||||
|         exclude group: 'com.squareup.okhttp3', module: 'okhttp' |         exclude group: 'com.squareup.okhttp3', module: 'okhttp' | ||||||
|   | |||||||
| @@ -111,7 +111,6 @@ android { | |||||||
|         release { |         release { | ||||||
|             signingConfig signingConfigs.debug |             signingConfig signingConfigs.debug | ||||||
|             minifyEnabled enableProguardInReleaseBuilds |             minifyEnabled enableProguardInReleaseBuilds | ||||||
|             matchingFallbacks = ['release', 'debug'] |  | ||||||
|             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" |             proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| @@ -132,10 +131,8 @@ android { | |||||||
|  |  | ||||||
| dependencies { | dependencies { | ||||||
|     implementation project(':react-native-video') |     implementation project(':react-native-video') | ||||||
|     compile "com.android.support:appcompat-v7:28.0.0" |     implementation "androidx.appcompat:appcompat:1.0.0" | ||||||
|     implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" |  | ||||||
|     implementation "com.facebook.react:react-native:+"  // From node_modules |     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 | // Run this once to be able to run the application with BUCK | ||||||
|   | |||||||
| @@ -24,8 +24,8 @@ public class MainApplication extends Application implements ReactApplication { | |||||||
|     protected List<ReactPackage> getPackages() { |     protected List<ReactPackage> getPackages() { | ||||||
|       return Arrays.asList( |       return Arrays.asList( | ||||||
|         new MainReactPackage(), |         new MainReactPackage(), | ||||||
|             new ReactVideoPackage() |         new ReactVideoPackage() | ||||||
|           ); |       ); | ||||||
|     } |     } | ||||||
|   }; |   }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,9 +24,7 @@ buildscript { | |||||||
| allprojects { | allprojects { | ||||||
|     repositories { |     repositories { | ||||||
|         mavenLocal() |         mavenLocal() | ||||||
|         maven { |         google() | ||||||
|            url 'https://maven.google.com' |  | ||||||
|         } |  | ||||||
|         maven { |         maven { | ||||||
|            url "https://jitpack.io" |            url "https://jitpack.io" | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -3,8 +3,4 @@ rootProject.name = 'VideoPlayer' | |||||||
| include ':react-native-video' | include ':react-native-video' | ||||||
| project(':react-native-video').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-video/android-exoplayer') | 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' | include ':app' | ||||||
|   | |||||||
| @@ -45,11 +45,6 @@ | |||||||
|     "scripts": { |     "scripts": { | ||||||
|         "test": "node_modules/.bin/eslint *.js" |         "test": "node_modules/.bin/eslint *.js" | ||||||
|     }, |     }, | ||||||
|     "rnpm": { |  | ||||||
|         "android": { |  | ||||||
|             "sourceDir": "./android-exoplayer" |  | ||||||
|         } |  | ||||||
|     }, |  | ||||||
|     "files": [ |     "files": [ | ||||||
|         "android-exoplayer", |         "android-exoplayer", | ||||||
|         "android", |         "android", | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user