Skip to content

Commit 7f3b2e5

Browse files
authored
Merge pull request #218 from digiboridev/fix/android_actualize
update: migrate to new android AGP dsl, bump webrtc
2 parents e9d5906 + 94099d5 commit 7f3b2e5

File tree

7 files changed

+482
-43
lines changed

7 files changed

+482
-43
lines changed

android/app/build.gradle

+13-19
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
plugins {
2+
id "com.android.application"
3+
id "kotlin-android"
4+
id "dev.flutter.flutter-gradle-plugin"
5+
}
6+
17
def localProperties = new Properties()
28
def localPropertiesFile = rootProject.file('local.properties')
39
if (localPropertiesFile.exists()) {
@@ -6,11 +12,6 @@ if (localPropertiesFile.exists()) {
612
}
713
}
814

9-
def flutterRoot = localProperties.getProperty('flutter.sdk')
10-
if (flutterRoot == null) {
11-
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
12-
}
13-
1415
def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
1516
if (flutterVersionCode == null) {
1617
flutterVersionCode = '1'
@@ -21,12 +22,11 @@ if (flutterVersionName == null) {
2122
flutterVersionName = '1.0'
2223
}
2324

24-
apply plugin: 'com.android.application'
25-
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26-
2725
android {
28-
compileSdkVersion 28
29-
ndkVersion "21.4.7075529"
26+
namespace "com.cloudwebrtc.flutterwebrtcdemo"
27+
compileSdkVersion flutter.compileSdkVersion
28+
ndkVersion flutter.ndkVersion
29+
3030

3131
lintOptions {
3232
disable 'InvalidPackage'
@@ -35,8 +35,8 @@ android {
3535
defaultConfig {
3636
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
3737
applicationId "com.cloudwebrtc.flutterwebrtcdemo"
38-
minSdkVersion 21
39-
targetSdkVersion 28
38+
minSdkVersion 23
39+
targetSdkVersion flutter.targetSdkVersion
4040
versionCode flutterVersionCode.toInteger()
4141
versionName flutterVersionName
4242
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
@@ -52,8 +52,6 @@ android {
5252
// TODO: Add your own signing config for the release build.
5353
// Signing with the debug keys for now, so `flutter run --release` works.
5454
signingConfig signingConfigs.debug
55-
useProguard true
56-
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
5755
}
5856
}
5957
packagingOptions {
@@ -65,8 +63,4 @@ flutter {
6563
source '../..'
6664
}
6765

68-
dependencies {
69-
testImplementation 'junit:junit:4.12'
70-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
71-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
72-
}
66+
dependencies {}

android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
android:value="2" />
3030
<activity
3131
android:name="io.flutter.embedding.android.FlutterActivity"
32+
android:exported="true"
3233
android:launchMode="singleTop"
3334
android:theme="@style/LaunchTheme"
3435
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"

android/build.gradle

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
buildscript {
2-
repositories {
3-
google()
4-
jcenter()
5-
}
6-
7-
dependencies {
8-
classpath 'com.android.tools.build:gradle:4.0.0'
9-
}
10-
}
111

122
allprojects {
133
repositories {
@@ -24,6 +14,6 @@ subprojects {
2414
project.evaluationDependsOn(':app')
2515
}
2616

27-
task clean(type: Delete) {
17+
tasks.register("clean", Delete) {
2818
delete rootProject.buildDir
2919
}

android/gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip

android/settings.gradle

+22-10
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,27 @@
1-
include ':app'
21

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
2+
pluginManagement {
3+
def flutterSdkPath = {
4+
def properties = new Properties()
5+
file("local.properties").withInputStream { properties.load(it) }
6+
def flutterSdkPath = properties.getProperty("flutter.sdk")
7+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
8+
return flutterSdkPath
9+
}()
410

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
11+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
12+
13+
repositories {
14+
google()
15+
mavenCentral()
16+
gradlePluginPortal()
17+
}
918
}
1019

11-
plugins.each { name, path ->
12-
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
13-
include ":$name"
14-
project(":$name").projectDir = pluginDirectory
20+
plugins {
21+
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
22+
id "com.android.application" version '8.1.1' apply false
23+
id "org.jetbrains.kotlin.android" version "2.0.0" apply false
1524
}
25+
26+
include ":app"
27+

0 commit comments

Comments
 (0)