Skip to content

Commit 27fe4d0

Browse files
committed
Add version 2.4.0
1 parent cbe73ab commit 27fe4d0

File tree

11 files changed

+172
-103
lines changed

11 files changed

+172
-103
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## [2.4.0]
2+
3+
### Changed
4+
5+
* 🚨 With this version you might need to create symlinks when using Android Gradle Plugin version `4.x`. Please refer to the new [known issues](https://github.com/imgly/pesdk-flutter#known-issues) section of the README for details.
6+
* 🚨 This version requires `minSdkVersion` `21` for Android. Please refer to the new step 3 in the [getting started](https://github.com/imgly/pesdk-flutter#android) section of the README for instructions on how to adjust it.
7+
* [video_editor_sdk] Raised minimum VideoEditor SDK for Android version to 10.0.1. See the [changelog](https://github.com/imgly/vesdk-android-demo/blob/master/CHANGELOG.md) for more information.
8+
* [photo_editor_sdk] Raised minimum PhotoEditor SDK for Android version to 10.0.1. See the [changelog](https://github.com/imgly/pesdk-android-demo/blob/master/CHANGELOG.md) for more information.
9+
110
## [2.3.0]
211

312
### Changed

README.md

Lines changed: 98 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Add the plugin package to the `pubspec.yaml` file in your project:
2323

2424
```yaml
2525
dependencies:
26-
video_editor_sdk: ^2.3.0
26+
video_editor_sdk: ^2.4.0
2727
```
2828
2929
Install the new dependency:
@@ -32,38 +32,77 @@ Install the new dependency:
3232
flutter pub get
3333
```
3434

35-
### Android
35+
### Known Issues
3636

37-
1. Because VideoEditor SDK for Android is quite large, there is a high chance that you will need to enable Multidex for your project as follows:
37+
With version `2.4.0`, we recommend using `compileSdkVersion` not lower than `31.0.0` for Android. However, this might interfere with your application's Android Gradle Plugin version if this is set to `4.x`.
3838

39-
Open the `android/app/build.gradle file` (**not** `android/build.gradle`) and add these lines at the end:
40-
```groovy
41-
android {
42-
defaultConfig {
43-
multiDexEnabled true
44-
}
45-
}
46-
dependencies {
47-
implementation 'androidx.multidex:multidex:2.0.1'
48-
}
49-
```
39+
If you don't use a newer Android Gradle Plugin version you'll most likely encounter a build error similar to:
40+
```
41+
FAILURE: Build failed with an exception.
5042
51-
2. Add the img.ly repository and plugin by opening the `android/build.gradle` file (**not** `android/app/build.gradle`) and adding these lines at the top:
52-
```groovy
43+
* Where:
44+
Build file 'flutter_test_application/android/build.gradle' line: 30
45+
46+
* What went wrong:
47+
A problem occurred evaluating root project 'android'.
48+
> A problem occurred configuring project ':app'.
49+
> Installed Build Tools revision 31.0.0 is corrupted. Remove and install again using the SDK Manager.
50+
51+
* Try:
52+
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
53+
54+
* Get more help at https://help.gradle.org
55+
```
56+
**As a workaround you can either:**
57+
58+
1. Upgrade your Android Gradle Plugin version:
59+
60+
Inside `android/build.gradle` update the version to at least `7.0.0`:
61+
```diff
62+
buildscript {
63+
...
64+
dependencies {
65+
- classpath 'com.android.tools.build:gradle:4.1.1'
66+
+ classpath 'com.android.tools.build:gradle:7.0.0'
67+
...
68+
}
69+
}
70+
```
71+
72+
After this, you need to update the Gradle version as well in `android/gradle/gradle-wrapper.properties`:
73+
```diff
74+
- distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip
75+
+ distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
76+
```
77+
78+
2. **Or** create the following symlinks:
79+
- Inside `/Users/YOUR-USERNAME/Library/Android/sdk/build-tools/31.0.0/`: Create a `dx` symlink for the `d8` file with `ln -s d8 dx`.
80+
- From there, go to `./lib/` and create a `dx.jar` symlink for the `d8.jar` file with `ln -s d8.jar dx.jar`.
81+
82+
### Android
83+
84+
1. Add the img.ly repository and plugin by opening the `android/build.gradle` file (**not** `android/app/build.gradle`) and changing the following block:
85+
86+
```diff
5387
buildscript {
88+
- ext.kotlin_version = '1.3.50'
89+
+ ext.kotlin_version = '1.5.32' // Minimum version.
5490
repositories {
91+
...
5592
mavenCentral()
56-
maven { url "https://artifactory.img.ly/artifactory/imgly" }
93+
+ maven { url "https://artifactory.img.ly/artifactory/imgly" }
94+
...
5795
}
5896
dependencies {
59-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10"
60-
classpath 'ly.img.android.sdk:plugin:9.2.0'
97+
...
98+
+ classpath 'ly.img.android.sdk:plugin:10.0.1'
99+
...
61100
}
62101
}
63102
```
64-
In order to update VideoEditor SDK for Android replace the version string `9.2.0` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
103+
In order to update VideoEditor SDK for Android replace the version string `10.0.1` with a [newer release](https://github.com/imgly/pesdk-android-demo/releases).
65104

66-
3. Still in the `android/build.gradle` file (**not** `android/app/build.gradle`), add these lines at the bottom:
105+
2. Still in the `android/build.gradle` file (**not** `android/app/build.gradle`), add these lines at the bottom:
67106

68107
```groovy
69108
allprojects {
@@ -73,7 +112,44 @@ flutter pub get
73112
}
74113
```
75114

76-
4. Configure VideoEditor SDK for Android by opening the `android/app/build.gradle` file (**not** `android/build.gradle`) and adding the following lines under `apply plugin: "com.android.application"`:
115+
3. In the `android/app/build.gradle` file (**not** `android/build.gradle`) you will need to modify the `minSdkVersion` to at least `21`. We also recommend to update the `buildToolsVersion` to `31.0.0` or higher as well as the `compileSdkVersion` to `31` or higher:
116+
117+
```diff
118+
android {
119+
- compileSdkVersion flutter.compileSdkVersion
120+
+ compileSdkVersion 31
121+
+ buildToolsVersion "31.0.0"
122+
...
123+
defaultConfig {
124+
...
125+
- minSdkVersion flutter.minSdkVersion
126+
+ minSdkVersion 21
127+
...
128+
}
129+
...
130+
}
131+
```
132+
133+
Depending on your **stable** Flutter SDK version (<= `2.5.0`), your `android/app/build.gradle` file might look a bit different. In this case, please modify it in the following way:
134+
135+
```diff
136+
android {
137+
- compileSdkVersion 30
138+
+ compileSdkVersion 31
139+
+ buildToolsVersion "31.0.0"
140+
...
141+
defaultConfig {
142+
...
143+
- minSdkVersion 16
144+
+ minSdkVersion 21
145+
...
146+
}
147+
...
148+
}
149+
```
150+
151+
4. In the same file, configure VideoEditor SDK for Android by adding the following lines under `apply plugin: "com.android.application"`:
152+
77153
```groovy
78154
apply plugin: 'ly.img.android.sdk'
79155
apply plugin: 'kotlin-android'

android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ group 'ly.img.flutter.video_editor_sdk'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
5-
ext.kotlin_version = '1.4.10'
5+
ext.kotlin_version = '1.5.32'
66

77
repositories {
88
google()
@@ -39,7 +39,7 @@ imglyConfig {
3939
}
4040
}
4141

42-
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "9.2.0"
42+
def MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION = "10.0.1"
4343

4444
task checkVersion {
4545
if (imglyConfig.convertToVersionNumber(imglyConfig.getVersion()) < imglyConfig.convertToVersionNumber(MIN_LY_IMG_ANDROID_SDK_PLUGIN_VERSION)) {
@@ -58,13 +58,13 @@ task checkVersion {
5858
preBuild.dependsOn checkVersion
5959

6060
android {
61-
compileSdkVersion 29
61+
compileSdkVersion 31
6262

6363
sourceSets {
6464
main.java.srcDirs += 'src/main/kotlin'
6565
}
6666
defaultConfig {
67-
minSdkVersion 16
67+
minSdkVersion 21
6868
}
6969
lintOptions {
7070
disable 'InvalidPackage'

android/src/main/kotlin/ly/img/flutter/video_editor_sdk/FlutterVESDK.kt

Lines changed: 45 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -97,26 +97,19 @@ class FlutterVESDK: FlutterIMGLY() {
9797
* @param serialization The serialization to load into the editor if any.
9898
*/
9999
override fun present(asset: String, config: HashMap<String, Any>?, serialization: String?) {
100-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
101-
val settingsList = VideoEditorSettingsList()
102-
103-
currentSettingsList = settingsList
104-
currentConfig = ConfigLoader.readFrom(config ?: mapOf()).also {
105-
it.applyOn(settingsList)
106-
}
107-
108-
settingsList.configure<LoadSettings> { loadSettings ->
109-
asset.also {
110-
loadSettings.source = retrieveURI(it)
111-
}
100+
val configuration = ConfigLoader.readFrom(config ?: mapOf())
101+
val settingsList = VideoEditorSettingsList(configuration.export?.serialization?.enabled == true)
102+
configuration.applyOn(settingsList)
103+
currentConfig = configuration
104+
105+
settingsList.configure<LoadSettings> { loadSettings ->
106+
asset.also {
107+
loadSettings.source = retrieveURI(it)
112108
}
113-
114-
readSerialisation(settingsList, serialization, false)
115-
startEditor(settingsList, EDITOR_RESULT_ID)
116-
} else {
117-
result?.error("VESDK", "The video editor is only available in Android 4.3 and later.", null)
118-
this.result = null
119109
}
110+
111+
readSerialisation(settingsList, serialization, false)
112+
startEditor(settingsList, EDITOR_RESULT_ID)
120113
}
121114

122115
/**
@@ -127,51 +120,43 @@ class FlutterVESDK: FlutterIMGLY() {
127120
* @param serialization The serialization to load into the editor if any.
128121
*/
129122
private fun present(videos: List<String>?, config: HashMap<String, Any>?, serialization: String?, size: Map<String, Any>?) {
130-
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
131-
val settingsList = VideoEditorSettingsList()
132-
var source = resolveSize(size)
133-
currentSettingsList = settingsList
134-
135-
currentConfig = ConfigLoader.readFrom(config ?: mapOf()).also {
136-
it.applyOn(settingsList)
137-
}
138-
139-
if (videos != null && videos.count() > 0) {
140-
if (source == null) {
141-
if (size != null) {
142-
result?.error("VESDK", "Invalid video size: width and height must be greater than zero.", null)
143-
this.result = null
144-
return
145-
}
146-
val video = videos.first()
147-
source = retrieveURI(video)
148-
}
149-
150-
settingsList.configure<VideoCompositionSettings> { loadSettings ->
151-
videos.forEach {
152-
val resolvedSource = retrieveURI(it)
153-
loadSettings.addCompositionPart(VideoCompositionSettings.VideoPart(resolvedSource))
154-
}
155-
}
156-
} else {
157-
if (source == null) {
158-
result?.error("VESDK", "A video composition without assets must have a specific size.", null)
123+
val configuration = ConfigLoader.readFrom(config ?: mapOf())
124+
val settingsList = VideoEditorSettingsList(configuration.export?.serialization?.enabled == true)
125+
configuration.applyOn(settingsList)
126+
currentConfig = configuration
127+
128+
var source = resolveSize(size)
129+
if (videos != null && videos.count() > 0) {
130+
if (source == null) {
131+
if (size != null) {
132+
result?.error("VESDK", "Invalid video size: width and height must be greater than zero.", null)
159133
this.result = null
160134
return
161135
}
136+
val video = videos.first()
137+
source = retrieveURI(video)
162138
}
163139

164-
settingsList.configure<LoadSettings> {
165-
it.source = source
140+
settingsList.configure<VideoCompositionSettings> { loadSettings ->
141+
videos.forEach {
142+
val resolvedSource = retrieveURI(it)
143+
loadSettings.addCompositionPart(VideoCompositionSettings.VideoPart(resolvedSource))
144+
}
166145
}
167-
168-
readSerialisation(settingsList, serialization, false)
169-
startEditor(settingsList, EDITOR_RESULT_ID)
170146
} else {
171-
result?.error("VESDK", "The video editor is only available in Android 4.3 and later.", null)
172-
this.result = null
173-
return
147+
if (source == null) {
148+
result?.error("VESDK", "A video composition without assets must have a specific size.", null)
149+
this.result = null
150+
return
151+
}
152+
}
153+
154+
settingsList.configure<LoadSettings> {
155+
it.source = source
174156
}
157+
158+
readSerialisation(settingsList, serialization, false)
159+
startEditor(settingsList, EDITOR_RESULT_ID)
175160
}
176161

177162
private fun retrieveURI(source: String) : Uri {
@@ -227,18 +212,19 @@ class FlutterVESDK: FlutterIMGLY() {
227212
}
228213
return true
229214
} else if (resultCode == Activity.RESULT_OK && requestCode == EDITOR_RESULT_ID) {
230-
val settingsList = intentData.settingsList
231215
val serializationConfig = currentConfig?.export?.serialization
232216
val resultUri = intentData.resultUri
233217
val sourceUri = intentData.sourceUri
234218

235-
val serialization: Any? = if (serializationConfig?.enabled == true) {
219+
var serialization: Any? = null
220+
if (serializationConfig?.enabled == true) {
221+
val settingsList = intentData.settingsList
236222
skipIfNotExists {
237223
settingsList.let { settingsList ->
238224
if (serializationConfig.embedSourceImage == true) {
239225
Log.i("ImglySDK", "EmbedSourceImage is currently not supported by the Android SDK")
240226
}
241-
when (serializationConfig.exportType) {
227+
serialization = when (serializationConfig.exportType) {
242228
SerializationExportType.FILE_URL -> {
243229
val uri = serializationConfig.filename?.let {
244230
Uri.parse("$it.json")
@@ -253,12 +239,10 @@ class FlutterVESDK: FlutterIMGLY() {
253239
}
254240
}
255241
}
242+
settingsList.release()
256243
} ?: run {
257244
Log.i("ImglySDK", "You need to include 'backend:serializer' Module, to use serialisation!")
258-
null
259245
}
260-
} else {
261-
null
262246
}
263247

264248
val map = mutableMapOf<String, Any?>()

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ imglyConfig {
6161
}
6262

6363
android {
64-
compileSdkVersion 29
64+
compileSdkVersion 31
6565

6666
sourceSets {
6767
main.java.srcDirs += 'src/main/kotlin'
@@ -74,7 +74,7 @@ android {
7474
defaultConfig {
7575
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
7676
applicationId "ly.img.flutter.video_editor_sdk_example"
77-
minSdkVersion 16
77+
minSdkVersion 21
7878
targetSdkVersion 29
7979
versionCode flutterVersionCode.toInteger()
8080
versionName flutterVersionName

example/android/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
additional functionality it is fine to subclass or reimplement
88
FlutterApplication and put your custom class here. -->
99
<application
10-
android:name="io.flutter.app.FlutterApplication"
10+
android:name="${applicationName}"
1111
android:label="video_editor_sdk_example"
1212
tools:replace="label"
1313
android:icon="@mipmap/ic_launcher">

example/android/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
2-
ext.kotlin_version = '1.4.10'
3-
ext.vesdk_version = '9.2.0'
2+
ext.kotlin_version = '1.5.32'
3+
ext.vesdk_version = '10.0.1'
44

55
repositories {
66
google()

0 commit comments

Comments
 (0)