Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to latest Android SDK, AGP and protobuf plugin #763

Closed
wants to merge 21 commits into from
Closed
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
6 changes: 2 additions & 4 deletions bin/quality_checks.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#!/bin/bash -ex
#workaround for codemagic CI since melos is not in bash
echo 'export PATH="$PATH":"$FLUTTER_ROOT/.pub-cache/bin"' >>~/.bashrc
echo 'export PATH="$PATH":"$FLUTTER_ROOT/bin"' >>~/.bashrc
source ~/.bashrc
export PATH="$PATH:$FLUTTER_ROOT/.pub-cache/bin"
export PATH="$PATH:$FLUTTER_ROOT/bin"

dart pub global activate melos

Expand Down
7 changes: 5 additions & 2 deletions codemagic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ workflows:
instance_type: mac_mini_m1
environment:
flutter: stable
xcode: 14.0
xcode: 14.3
cocoapods: default
java: 19.0.2
cache:
cache_paths: []
triggering:
Expand Down Expand Up @@ -39,6 +40,8 @@ workflows:
script: |
# set up local properties
echo "flutter.sdk=$HOME/programs/flutter" > "$FCI_BUILD_DIR/example/android/local.properties"
echo "$JAVA_HOME"
echo "org.gradle.java.home=$JAVA_HOME" >> "$FCI_BUILD_DIR/example/android/gradle.properties"
- name: Quality checks monorepo
script: |
./bin/quality_checks.sh
Expand All @@ -53,6 +56,6 @@ workflows:
find . -name "Podfile" -execdir pod install \;
cd example && flutter build ios --debug --no-codesign
artifacts:
- example/build/**/outputs/**/*.apk
- example/build/**/outputs/apk/*.apk
- example/build/**/outputs/**/mapping.txt
- example/build/ios/ipa/*.ipa
12 changes: 7 additions & 5 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,12 @@ apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion 31
compileSdkVersion 33

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

lintOptions {
disable 'InvalidPackage'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -48,7 +45,7 @@ android {
defaultConfig {
applicationId "com.signify.hue.reactivebleexample"
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
}
Expand All @@ -59,6 +56,11 @@ android {
signingConfig signingConfigs.debug
}
}
namespace 'com.signify.hue.reactivebleexample'

lint {
disable 'InvalidPackage'
}
}

flutter {
Expand Down
3 changes: 1 addition & 2 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.signify.hue.reactivebleexample">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<uses-permission android:name="android.permission.INTERNET" />
<!-- required for API 18 - 30 -->
Expand Down
4 changes: 2 additions & 2 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.8.21'
repositories {
mavenCentral()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.2'
classpath 'com.android.tools.build:gradle:8.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
5 changes: 4 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
android.enableJetifier=true
android.defaults.buildfeatures.buildconfig=true
android.enableJetifier=false
android.nonFinalResIds=false
android.nonTransitiveRClass=false
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
2 changes: 1 addition & 1 deletion example/android/gradle/wrapper/gradle-wrapper.properties
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.0.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
18 changes: 7 additions & 11 deletions example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
include ':app'

def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()

def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }

plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
18 changes: 10 additions & 8 deletions packages/reactive_ble_mobile/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version '1.0-SNAPSHOT'

buildscript {
ext.detekt_version = '1.17.1'
ext.kotlin_version = '1.5.31'
ext.kotlin_version = '1.8.21'
repositories {
google()
mavenCentral()
Expand All @@ -13,8 +13,8 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.0.3'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.17'
classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detekt_version"
classpath "de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1"
Expand All @@ -38,7 +38,7 @@ apply plugin: "io.gitlab.arturbosch.detekt"
apply plugin: "de.mannodermaus.android-junit5"

android {
compileSdkVersion 31
compileSdkVersion 33
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
Expand All @@ -51,11 +51,13 @@ android {

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 33
consumerProguardFiles 'proguard-rules.txt'
}

lintOptions {
namespace 'com.signify.hue.flutterreactiveble'

lint {
disable 'InvalidPackage'
}

Expand All @@ -79,7 +81,7 @@ detekt {

protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.18.1'
artifact = 'com.google.protobuf:protoc:3.23.0'
}

generateProtoTasks {
Expand All @@ -96,7 +98,7 @@ protobuf {
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.polidea.rxandroidble2:rxandroidble:1.16.0'
implementation 'com.google.protobuf:protobuf-javalite:3.18.1'
implementation 'com.google.protobuf:protobuf-javalite:3.23.0'
implementation 'io.reactivex.rxjava2:rxkotlin:2.4.0'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'

Expand Down
4 changes: 0 additions & 4 deletions packages/reactive_ble_mobile/android/gradle.properties

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.signify.hue.flutterreactiveble">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<!-- required for API 18 - 30 -->
<uses-permission
Expand Down