Skip to content

Commit b345c18

Browse files
authored
Android Gradle update | UMP - Support for new Debug Geography enums (#1223)
* UMP - Support for new Debug Geography enums * Changed deprecated members * Adjusted to the new double values for Colors
1 parent dfa3bf0 commit b345c18

File tree

15 files changed

+68
-59
lines changed

15 files changed

+68
-59
lines changed

packages/google_mobile_ads/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## Next Version
22
* Updated WebView Flutter Android dependency
3+
* Adds support for the new Debug Geography enums for the UMP SDK
34

45
## 5.2.0
56
* Removed use of rootViewController for iOS GMA SDK which solved issues like

packages/google_mobile_ads/android/build.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:8.0.1'
11+
classpath 'com.android.tools.build:gradle:8.3.2'
1212
}
1313
}
1414

@@ -41,9 +41,9 @@ android {
4141
implementation 'androidx.lifecycle:lifecycle-process:2.6.2'
4242
implementation 'com.google.errorprone:error_prone_annotations:2.16'
4343
testImplementation 'junit:junit:4.13.2'
44-
testImplementation 'org.hamcrest:hamcrest:2.2'
45-
testImplementation 'org.mockito:mockito-inline:5.2.0'
46-
testImplementation 'org.robolectric:robolectric:4.10.3'
44+
testImplementation 'org.hamcrest:hamcrest:3.0'
45+
testImplementation 'org.mockito:mockito-core:5.15.2'
46+
testImplementation 'org.robolectric:robolectric:4.14.1'
4747
testImplementation 'androidx.test:core:1.5.0'
4848
}
4949
testOptions {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sat May 13 14:37:03 CEST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

packages/google_mobile_ads/example/android/app/build.gradle

Lines changed: 12 additions & 11 deletions
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,9 +22,6 @@ 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 {
2826
compileSdkVersion 34
2927

@@ -52,8 +50,8 @@ android {
5250
}
5351

5452
compileOptions {
55-
sourceCompatibility JavaVersion.VERSION_17
56-
targetCompatibility JavaVersion.VERSION_17
53+
sourceCompatibility JavaLanguageVersion.of(17)
54+
targetCompatibility JavaLanguageVersion.of(17)
5755
}
5856
}
5957

@@ -62,7 +60,10 @@ flutter {
6260
}
6361

6462
dependencies {
65-
testImplementation 'junit:junit:4.12'
63+
testImplementation 'junit:junit:4.13.2'
64+
testImplementation 'org.robolectric:robolectric:4.14.1'
65+
testImplementation 'org.mockito:mockito-core:5.15.2'
66+
androidTestImplementation 'org.robolectric:robolectric:4.10.3'
6667
androidTestImplementation 'androidx.test:runner:1.2.0'
6768
androidTestImplementation 'androidx.test:rules:1.2.0'
6869
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'

packages/google_mobile_ads/example/android/build.gradle

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,3 @@
1-
buildscript {
2-
repositories {
3-
google()
4-
mavenCentral()
5-
}
6-
7-
dependencies {
8-
classpath 'com.android.tools.build:gradle:8.0.1'
9-
}
10-
}
11-
121
allprojects {
132
repositories {
143
google()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Sat May 13 14:40:00 CEST 2023
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists
Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
include ':app'
1+
pluginManagement {
2+
def flutterSdkPath = {
3+
def properties = new Properties()
4+
file("local.properties").withInputStream { properties.load(it) }
5+
def flutterSdkPath = properties.getProperty("flutter.sdk")
6+
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7+
return flutterSdkPath
8+
}()
29

3-
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
10+
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
411

5-
def plugins = new Properties()
6-
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
7-
if (pluginsFile.exists()) {
8-
pluginsFile.withInputStream { stream -> plugins.load(stream) }
12+
repositories {
13+
google()
14+
mavenCentral()
15+
gradlePluginPortal()
16+
}
917
}
1018

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

packages/google_mobile_ads/example/ios/RunnerTests/FLTUserMessagingPlatformReaderWriterTest.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ - (void)testConsentDebugSettings_default {
6969

7070
- (void)testConsentDebugSettings_geographyTestDeviceIdentifiers {
7171
UMPDebugSettings *debugSettings = [[UMPDebugSettings alloc] init];
72-
debugSettings.geography = UMPDebugGeographyNotEEA;
72+
debugSettings.geography = UMPDebugGeographyOther;
7373
debugSettings.testDeviceIdentifiers = @[ @"id-1", @"id-2" ];
7474
NSData *encodedMessage = [messageCodec encode:debugSettings];
7575

packages/google_mobile_ads/example/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ dependencies:
2020
sdk: flutter
2121
google_mobile_ads:
2222
path: ../
23-
webview_flutter_android: ^4.0.0
24-
webview_flutter: ^4.0.5
23+
webview_flutter_android: ^4.3.0
24+
webview_flutter: ^4.10.0
2525

2626
dev_dependencies:
2727
pedantic: ^1.11.0

packages/google_mobile_ads/lib/src/ad_instance_manager.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import 'dart:io';
2222

2323
import 'package:flutter/cupertino.dart';
2424
import 'package:flutter/foundation.dart';
25+
import 'package:flutter/material.dart';
2526
import 'package:flutter/services.dart';
2627
import 'package:google_mobile_ads/src/ad_inspector_containers.dart';
2728
import 'package:google_mobile_ads/src/ad_listeners.dart';
@@ -988,10 +989,10 @@ class AdMessageCodec extends StandardMessageCodec {
988989
writeValue(buffer, value.size);
989990
} else if (value is Color) {
990991
buffer.putUint8(_valueColor);
991-
writeValue(buffer, value.alpha);
992-
writeValue(buffer, value.red);
993-
writeValue(buffer, value.green);
994-
writeValue(buffer, value.blue);
992+
writeValue(buffer, (value.a * 255).toInt());
993+
writeValue(buffer, (value.r * 255).toInt());
994+
writeValue(buffer, (value.g * 255).toInt());
995+
writeValue(buffer, (value.b * 255).toInt());
995996
} else if (value is NativeTemplateFontStyle) {
996997
buffer.putUint8(_valueNativeTemplateFontStyle);
997998
writeValue(buffer, value.index);

0 commit comments

Comments
 (0)