Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
59 changes: 59 additions & 0 deletions .github/workflows/android-compatibility.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Android compatibility

on:
pull_request:
push:
branches:
- main

permissions:
contents: read

concurrency:
group: android-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: agp-9-compatibility
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
flutter-version: 3.47.4
cache: true

- name: Install package dependencies
run: flutter pub get

- name: Analyze package
run: flutter analyze

- name: Run Dart tests
run: flutter test

- name: Install example dependencies
working-directory: example
run: flutter pub get

- name: Build complete example in KGP compatibility mode
working-directory: example
run: flutter build apk --debug

- name: Run Android plugin tests and lint
working-directory: example/android
run: ./gradlew :v_video_compressor:testDebugUnitTest lintDebug

- name: Verify AGP 9 built-in Kotlin integration
env:
# Flutter 3.47.4 incorrectly validates AGP's bundled Kotlin as if it
# were an independently upgradeable KGP version. Remove this override
# after https://github.com/flutter/flutter/issues/192167 is fixed.
FLUTTER_ANDROID_SKIP_BUILD_DEPENDENCY_VALIDATION: "true"
run: tool/verify_android_built_in_kotlin.sh
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## [Unreleased]

### Changed

- Migrated the Android plugin away from applying KGP so it supports AGP 9
built-in Kotlin, fixing #25. This raises the minimum supported toolchain to
Flutter 3.44 and Dart 3.12; enabling built-in Kotlin in an app requires
Flutter 3.47 or newer.

### Fixed

- Android H.264 exports now request the lowest H.264 level that covers the
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ This plugin **focuses exclusively on video compression and thumbnail generation*
| **iOS (SwiftPM)** | ✅ **Full Support** | iOS 15.0+ | Current Flutter toolchains |
| **iOS (CocoaPods)** | ✅ **Full Support** | iOS 12.0+ | Legacy Flutter toolchain metadata |

The package requires Flutter 3.44 or newer and Dart 3.12 or newer. Android
apps can use either Flutter's legacy KGP compatibility mode or AGP 9 built-in
Kotlin; enabling built-in Kotlin requires Flutter 3.47 or newer.

## 🚀 **Quick Start**

### 1. Installation
Expand Down
16 changes: 6 additions & 10 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,12 @@ allprojects {
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

kotlin {
compilerOptions {
jvmTarget = org.jetbrains.kotlin.gradle.dsl.JvmTarget.JVM_11
}
}

android {
namespace = "com.v_chat_sdk.v_video_compressor"
Expand All @@ -34,15 +39,6 @@ android {
targetCompatibility = JavaVersion.VERSION_11
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_11
}

sourceSets {
main.java.srcDirs += "src/main/kotlin"
test.java.srcDirs += "src/test/kotlin"
}

defaultConfig {
minSdk = 21
}
Expand Down
16 changes: 8 additions & 8 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
url: "https://pub.dev"
source: hosted
version: "0.12.19"
version: "0.12.20"
material_color_utilities:
dependency: transitive
description:
Expand All @@ -427,10 +427,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -624,10 +624,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
sha256: "2a122cbe059f8b610d3a5415f42e255b6c17b1f21eee1d960f31080237fb4f11"
url: "https://pub.dev"
source: hosted
version: "0.7.11"
version: "0.7.12"
transparent_image:
dependency: transitive
description:
Expand Down Expand Up @@ -655,10 +655,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
sha256: f36f9f3be64c6198714492bb455c11056e33e2f85d9a0b676a48301e44fdcf47
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.4.2"
video_player:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: "Demonstrates how to use the v_video_compressor plugin."
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: ^3.8.1
sdk: ^3.12.0

# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/v-chat-sdk/v_video_compressor
issue_tracker: https://github.com/v-chat-sdk/v_video_compressor/issues

environment:
sdk: ">=3.2.0 <4.0.0"
flutter: ">=3.3.0"
sdk: ^3.12.0
flutter: ">=3.44.0"

dependencies:
flutter:
Expand Down
45 changes: 45 additions & 0 deletions tool/verify_android_built_in_kotlin.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/usr/bin/env bash

set -euo pipefail

repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
flutter_bin="${FLUTTER_BIN:-flutter}"
fixture_parent="$(mktemp -d "${TMPDIR:-/tmp}/vvc-built-in-kotlin.XXXXXX")"
fixture_dir="$fixture_parent/app"

cleanup() {
rm -rf "$fixture_parent"
}
trap cleanup EXIT

"$flutter_bin" create \
--empty \
--org com.v_chat_sdk \
--platforms android \
--project-name vvc_built_in_kotlin \
"$fixture_dir"

(
cd "$fixture_dir"
"$flutter_bin" pub add "v_video_compressor@{path: $repo_root}"

sed -i.bak '/org.jetbrains.kotlin.android/d' android/settings.gradle.kts
rm android/settings.gradle.kts.bak
sed -i.bak \
's/android.builtInKotlin=false/android.builtInKotlin=true/' \
android/gradle.properties
rm android/gradle.properties.bak

grep -Fq 'android.builtInKotlin=true' android/gradle.properties
if grep -Eq 'kotlin-android|org.jetbrains.kotlin.android' \
android/settings.gradle.kts android/app/build.gradle.kts; then
echo 'The built-in Kotlin fixture still applies KGP.' >&2
exit 1
fi

build_args=(build apk --debug)
if [[ "${FLUTTER_ANDROID_SKIP_BUILD_DEPENDENCY_VALIDATION:-false}" == "true" ]]; then
build_args+=(--android-skip-build-dependency-validation)
fi
"$flutter_bin" "${build_args[@]}"
)
Loading