Skip to content

Commit

Permalink
Add support of namespace property to support Android Gradle Plugin 8. (
Browse files Browse the repository at this point in the history
…#843)

* Add support of namespace property to support Android Gradle Plugin 8.

* Now allowing the plugin to be retrocompatible with previous versions of AGP.

* Updated Java version from 11 to 17.

* Updated the Java version.

* Updated dependencies.

* Enabled multidex support.
  • Loading branch information
Skyost authored Oct 12, 2023
1 parent 0a05d49 commit 0692ee8
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/google_mobile_ads.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: "Install Flutter"
run: ./.github/workflows/scripts/install-flutter.sh stable
- name: "Install Tools"
Expand Down
38 changes: 20 additions & 18 deletions packages/google_mobile_ads/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {
}

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

Expand All @@ -24,30 +24,33 @@ apply plugin: 'com.android.library'
android {
compileSdkVersion 33

if (project.android.hasProperty('namespace')) {
namespace 'io.flutter.plugins.googlemobileads'
}

defaultConfig {
minSdkVersion 19
}
lintOptions {
disable 'InvalidPackage'
}
dependencies {
api 'com.google.android.gms:play-services-ads:22.0.0'
implementation 'com.google.android.ump:user-messaging-platform:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-process:2.2.0'
implementation 'com.google.errorprone:error_prone_annotations:2.16'
testImplementation 'junit:junit:4.12'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-inline:3.9.0'
testImplementation 'org.robolectric:robolectric:4.4'
testImplementation 'androidx.test:core:1.3.0'

api 'com.google.android.gms:play-services-ads:22.4.0'
implementation 'com.google.android.ump:user-messaging-platform:2.1.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-process:2.6.2'
implementation 'com.google.errorprone:error_prone_annotations:2.16'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.hamcrest:hamcrest:2.2'
testImplementation 'org.mockito:mockito-inline:5.2.0'
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'androidx.test:core:1.5.0'
}
testOptions {
unitTests {
includeAndroidResources = true
testOptions {
unitTests {
includeAndroidResources = true
}
}
}
}

afterEvaluate {
Expand All @@ -56,8 +59,7 @@ afterEvaluate {
for (def dependency : configuration.dependencies) {
if (dependency.group == 'io.flutter' &&
dependency.name.startsWith('flutter_embedding') &&
dependency.isTransitive())
{
dependency.isTransitive()) {
containsEmbeddingDependencies = true
break
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Aug 06 00:12:49 EDT 2021
#Sat May 13 14:37:03 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 5 additions & 2 deletions packages/google_mobile_ads/example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
android {
compileSdkVersion 33

namespace 'io.flutter.plugins.googlemobileadsexample'

lintOptions {
disable 'InvalidPackage'
}
Expand All @@ -38,6 +40,7 @@ android {
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}

buildTypes {
Expand All @@ -49,8 +52,8 @@ android {
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}
}

Expand Down
2 changes: 1 addition & 1 deletion packages/google_mobile_ads/example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

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

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Thu Mar 18 15:32:52 PDT 2021
#Sat May 13 14:40:00 CEST 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip

0 comments on commit 0692ee8

Please sign in to comment.