Skip to content

Commit

Permalink
Depend on the min SDK version of Flutter installation (#1397)
Browse files Browse the repository at this point in the history
* Depend on the min SDK version of Flutter installation

* Migrate away from deprecated imperative apply

* Ensure git action works with Java 17
  • Loading branch information
mvanbeusekom authored Oct 17, 2024
1 parent 4e840ae commit a0ded20
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/permission_handler_android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3

# Make sure JAVA version 17 is installed on build agent.
- uses: actions/setup-java@v3
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '17'

# Make sure the stable version of Flutter is available
- uses: subosito/flutter-action@v2
with:
Expand Down
5 changes: 5 additions & 0 deletions permission_handler_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 12.0.13

* Updates the Android min SDK to 19 (from 16).
* Migrates example app away from deprecated imperative apply in gradle (see: https://docs.flutter.dev/release/breaking-changes/flutter-gradle-plugin-apply).

## 12.0.12

* Fixes permission status returned from `Permission.photos.request()` or `Permission.videos.request()` when limited access selected
Expand Down
2 changes: 1 addition & 1 deletion permission_handler_android/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ android {
}

defaultConfig {
minSdkVersion 16
minSdkVersion 19
}
}
8 changes: 5 additions & 3 deletions permission_handler_android/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -21,9 +26,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
namespace 'com.baseflow.permissionhandler.example'
compileSdk 34
Expand Down
13 changes: 2 additions & 11 deletions permission_handler_android/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
}
}

allprojects {
repositories {
google()
Expand All @@ -19,6 +8,8 @@ allprojects {
rootProject.buildDir = '../build'
subprojects {
project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
project.evaluationDependsOn(':app')
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip
29 changes: 19 additions & 10 deletions permission_handler_android/example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.1.0" apply false
}

include ":app"
2 changes: 1 addition & 1 deletion permission_handler_android/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: permission_handler_android
description: Permission plugin for Flutter. This plugin provides the Android API to request and check permissions.
homepage: https://github.com/baseflow/flutter-permission-handler
version: 12.0.12
version: 12.0.13

environment:
sdk: ">=2.15.0 <4.0.0"
Expand Down

0 comments on commit a0ded20

Please sign in to comment.