Skip to content

Update Gradle and Android Plugins #1244

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

Merged
merged 11 commits into from
Aug 11, 2025
Merged
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
5 changes: 3 additions & 2 deletions .github/workflows/copilot-setup-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Install Android workload
run: dotnet workload install android

- name: Setup OpenJDK 11
- name: Setup OpenJDK 21
uses: actions/setup-java@v4
with:
distribution: 'microsoft'
java-version: '11'
java-version: '21'

- name: Restore dotnet tools
run: dotnet tool restore
Expand Down Expand Up @@ -58,6 +58,7 @@ jobs:
echo ".NET Version: $(dotnet --version)"
echo "Java Version: $(java -version 2>&1 | head -1)"
echo "Android SDK Root: $ANDROID_SDK_ROOT"
echo "Android Home: $ANDROID_HOME"
echo "Java Home: $JAVA_HOME"
echo "=== Installed Workloads ==="
dotnet workload list
5 changes: 2 additions & 3 deletions BUILDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ Before building the libraries and samples in this repository, you will need to i
dotnet tool install -g cake.tool
```

* [Microsoft OpenJDK *11*](https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-11)
(JDK-17 is not currently supported).
* [Microsoft OpenJDK *21*](https://learn.microsoft.com/en-us/java/openjdk/download#openjdk-21)

The `javac` from your JDK 11 installation must be *first* in `$PATH`/`%PATH%`.
The `javac` from your JDK 21 installation must be *first* in `$PATH`/`%PATH%`.

* The [Android SDK](https://developer.android.com/studio), and the
`ANDROID_SDK_ROOT` environment variable set to the Android SDK location.
Expand Down
4 changes: 4 additions & 0 deletions build/cake/build-and-package.cake
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ void BuildGradleProject (string root, string outputDir, bool moveFile)
void RunGradle (DirectoryPath root, string target)
{
root = MakeAbsolute (root);

Information($"Running Gradle {target} in {root}");

var proc = IsRunningOnWindows ()
? root.CombineWithFilePath ("gradlew.bat").FullPath
Expand All @@ -102,6 +104,8 @@ void RunGradle (DirectoryPath root, string target)

args += $" {target} -p {root}";

Information($"Running {proc} {args}");

var exitCode = StartProcess (proc, args);

if (exitCode != 0)
Expand Down
8 changes: 7 additions & 1 deletion build/ci/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ parameters:

steps:
- pwsh: |
Get-Content $PSCommandPath
dotnet cake build.cake `
--target=ci-build `
--configuration="$(configuration)" `
Expand All @@ -21,12 +22,14 @@ steps:
RepositoryType: "git"

- pwsh: |
Get-Content $PSCommandPath
dotnet cake validation.cake `
--namespaces="${{ join(',', parameters.validPackagePrefixes) }}" `
--verbosity="$(verbosity)"
displayName: 'Run NuGet package validation'

- pwsh: |
Get-Content $PSCommandPath
dotnet cake nuget-diff.cake `
--artifacts="${{ parameters.artifactsPath }}" `
--output="${{ parameters.artifactsPath }}/api-diff" `
Expand All @@ -35,10 +38,13 @@ steps:
displayName: 'Generate API diff'
condition: eq(variables['Agent.OS'], 'Windows_NT')

- pwsh: dotnet cake utilities.cake -t=verify-namespace-file
- pwsh: |
Get-Content $PSCommandPath
dotnet cake utilities.cake -t=verify-namespace-file
displayName: Verify published namespaces

- pwsh: |
Get-Content $PSCommandPath
dotnet cake build.cake `
--target=ci-samples `
--configuration="$(configuration)" `
Expand Down
1 change: 1 addition & 0 deletions build/ci/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:

# Copy SignList.xml to output
- pwsh: |
Get-Content $PSCommandPath
$srcExists = (Test-Path "${{ parameters.signListPath }}")
$dstExists = (Test-Path "${{ parameters.artifactsPath }}\SignList.xml")
if ($srcExists -and !$dstExists) {
Expand Down
16 changes: 8 additions & 8 deletions build/ci/job-extended-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ jobs:
arguments: -c $(configuration)

# Figure out which tests this slice is running
- pwsh: >-
dotnet dotnet-test-slicer
slice
--test-assembly="${{ parameters.testAssembly }}"
--test-filter="${{ parameters.testFilter }}"
--slice-number=$(System.JobPositionInPhase)
--total-slices=$(System.TotalJobsInPhase)
--outfile="${{ parameters.testAssembly }}.runsettings"
- pwsh: |
Get-Content $PSCommandPath
dotnet dotnet-test-slicer slice `
--test-assembly="${{ parameters.testAssembly }}" `
--test-filter="${{ parameters.testFilter }}" `
--slice-number=$(System.JobPositionInPhase) `
--total-slices=$(System.TotalJobsInPhase) `
--outfile="${{ parameters.testAssembly }}.runsettings"
displayName: Slice unit tests
failOnStderr: true
Expand Down
29 changes: 15 additions & 14 deletions build/ci/setup-environment.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
parameters:
installAndroidDependencies: false
androidSdkRoot: $(Agent.TempDirectory)/android-sdk
javaSdkRoot: $(Agent.ToolsDirectory)\jdk11
javaSdkRoot: $(Agent.ToolsDirectory)\jdk21

steps:
# before the build starts, make sure the tooling is as expected. Clear the cache on shared agents
Expand Down Expand Up @@ -46,18 +46,18 @@ steps:

- bash: |
if [[ "$(Agent.Name)" == *"Azure Pipelines"* ]]; then
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_11_X64)"
echo "##vso[task.setvariable variable=JAVA_HOME]$(JAVA_HOME_21_X64)"
else
echo "##vso[task.setvariable variable=JAVA_HOME]/Library/Java/JavaVirtualMachines/microsoft-11.jdk/Contents/Home"
echo "##vso[task.setvariable variable=JAVA_HOME]/Library/Java/JavaVirtualMachines/microsoft-21.jdk/Contents/Home"
fi
displayName: Use Java 11 SDK (Mac)
displayName: Use Java 21 SDK (Mac)
condition: eq( variables['Agent.OS'], 'Darwin' )

- task: JavaToolInstaller@0
displayName: Use Java 11 SDK (Windows)
displayName: Use Java 21 SDK (Windows)
condition: and(eq( variables['Agent.OS'], 'Windows_NT' ), ne(${{ parameters.installAndroidDependencies }}, true))
inputs:
versionSpec: '11'
versionSpec: '21'
jdkArchitectureOption: 'x64'
jdkSourceOption: 'PreInstalled'

Expand Down Expand Up @@ -86,26 +86,27 @@ steps:
- pwsh: |
Write-Host "##vso[task.setvariable variable=AndroidSdkDirectory]${{ parameters.androidSdkRoot }}"
Write-Host "##vso[task.setvariable variable=ANDROID_SDK_ROOT]${{ parameters.androidSdkRoot }}"
displayName: Set ANDROID_SDK_ROOT to ${{ parameters.androidSdkRoot }}
Write-Host "##vso[task.setvariable variable=ANDROID_HOME]${{ parameters.androidSdkRoot }}"
displayName: Set ANDROID_SDK_ROOT and ANDROID_HOME to ${{ parameters.androidSdkRoot }}

- ${{ if eq(parameters.installAndroidDependencies, true) }}:
- pwsh: |
$url = "https://aka.ms/download-jdk/microsoft-jdk-11.0.26-windows-x64.zip"
$url = "https://aka.ms/download-jdk/microsoft-jdk-21.0.8-windows-x64.zip"
if ($IsMacOS) {
$url = "https://aka.ms/download-jdk/microsoft-jdk-11.0.26-macos-x64.tar.gz"
$url = "https://aka.ms/download-jdk/microsoft-jdk-21.0.8-macos-x64.tar.gz"
}
$fileName = [System.IO.Path]::GetFileName($url)
Invoke-WebRequest -Uri $url -OutFile $fileName
Write-Host "##vso[task.setvariable variable=JDK_11_FILE_PATH]$(Build.StagingDirectory)/$fileName"
displayName: Download Java 11 SDK
Write-Host "##vso[task.setvariable variable=JDK_21_FILE_PATH]$(Build.StagingDirectory)/$fileName"
displayName: Download Java 21 SDK
workingDirectory: $(Build.StagingDirectory)

- task: JavaToolInstaller@0
displayName: Use Java 11 SDK
displayName: Use Java 21 SDK
inputs:
versionSpec: '11'
versionSpec: '21'
jdkArchitectureOption: 'x64'
jdkSourceOption: LocalDirectory
jdkFile: $(JDK_11_FILE_PATH)
jdkFile: $(JDK_21_FILE_PATH)
jdkDestinationDirectory: ${{ parameters.javaSdkRoot }}
cleanDestinationDirectory: true
3 changes: 0 additions & 3 deletions published-namespaces.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1367,8 +1367,6 @@ Xamarin.Google.Android.DataTransport.Runtime.Time
Xamarin.Google.Android.DataTransport.Runtime.Util
Xamarin.Google.Android.Finsky.ExternalReferrer
Xamarin.Google.Android.Odml.Image
Xamarin.Google.Android.Play.Asset.Delivery
Xamarin.Google.Android.Play.Core
Xamarin.Google.Android.Play.Core.AppUpdate
Xamarin.Google.Android.Play.Core.AppUpdate.Install
Xamarin.Google.Android.Play.Core.AppUpdate.Install.Model
Expand All @@ -1391,7 +1389,6 @@ Xamarin.Google.Android.Play.Core.SplitInstall
Xamarin.Google.Android.Play.Core.SplitInstall.Model
Xamarin.Google.Android.Play.Core.SplitInstall.Testing
Xamarin.Google.Android.Play.Core.Tasks
Xamarin.Google.Android.Play.Feature.Delivery
Xamarin.Google.Android.Recaptcha
Xamarin.Google.Crypto.Tink
Xamarin.Google.Crypto.Tink.Aead
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
namespace 'com.xamarin.google.android.material.extensions.app'
compileSdk 34

defaultConfig {
applicationId "com.xamarin.google.android.material.extensions.app"
minSdkVersion 16
targetSdkVersion 29
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"

Expand All @@ -20,7 +20,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xamarin.google.android.material.extensions.app">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application
android:allowBackup="true"
Expand All @@ -9,7 +8,8 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<activity android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ buildscript {

repositories {
google()
jcenter()
mavenCentral()

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


// NOTE: Do not place your application dependencies here; they belong
Expand All @@ -19,7 +19,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()

}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apply plugin: 'com.android.library'

android {
compileSdkVersion 29
buildToolsVersion "29.0.3"
namespace 'com.xamarin.google.android.material.extensions'
compileSdk 34

defaultConfig {
minSdkVersion 16
targetSdkVersion 29
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"

Expand All @@ -20,7 +20,11 @@ android {
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}


compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.xamarin.google.android.material.extensions" />
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#nullable enable
Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig
Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.BuildConfig() -> void
Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation
Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation.AssetLocation() -> void
Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation.AssetLocation(nint javaReference, Android.Runtime.JniHandleOwnership transfer) -> void
Expand Down Expand Up @@ -92,13 +90,6 @@ abstract Xamarin.Google.Android.Play.Core.AssetPacks.AssetPackState.TransferProg
abstract Xamarin.Google.Android.Play.Core.AssetPacks.AssetPackState.UpdateAvailability() -> int
abstract Xamarin.Google.Android.Play.Core.AssetPacks.AssetPackStates.PackStates() -> System.Collections.Generic.IDictionary<string!, Xamarin.Google.Android.Play.Core.AssetPacks.AssetPackState!>?
abstract Xamarin.Google.Android.Play.Core.AssetPacks.AssetPackStates.TotalBytes() -> long
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.ApplicationId = "xamarin.google.android.play.asset.delivery" -> string!
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.BuildType = "release" -> string!
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.Debug = false -> bool
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.Flavor = "" -> string!
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.LibraryPackageName = "xamarin.google.android.play.asset.delivery" -> string!
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.VersionCode = 1 -> int
const Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.VersionName = "1.0" -> string!
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackErrorCode.AccessDenied = -7 -> int
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackErrorCode.ApiNotAvailable = -5 -> int
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackErrorCode.AppNotOwned = -13 -> int
Expand Down Expand Up @@ -127,7 +118,6 @@ const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackStorageMethod.S
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackUpdateAvailability.Unknown = 0 -> int
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackUpdateAvailability.UpdateAvailable = 2 -> int
const Xamarin.Google.Android.Play.Core.AssetPacks.Model.AssetPackUpdateAvailability.UpdateNotAvailable = 1 -> int
override Xamarin.Google.Android.Play.Asset.Delivery.BuildConfig.JniPeerMembers.get -> Java.Interop.JniPeerMembers!
override Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation.JniPeerMembers.get -> Java.Interop.JniPeerMembers!
override Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation.ThresholdClass.get -> nint
override Xamarin.Google.Android.Play.Core.AssetPacks.AssetLocation.ThresholdType.get -> System.Type!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:3.6.2"
classpath "com.android.tools.build:gradle:8.12.0"

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -15,7 +15,7 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
Loading