diff --git a/.github/ci-gradle.properties b/.github/ci-gradle.properties
new file mode 100644
index 0000000..6fe41e0
--- /dev/null
+++ b/.github/ci-gradle.properties
@@ -0,0 +1,26 @@
+#
+# Copyright 2025 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.gradle.configureondemand=true
+org.gradle.caching=true
+org.gradle.parallel=true
+
+# Declare we support AndroidX
+android.useAndroidX=true
+
+org.gradle.jvmargs=-Xmx4608m -XX:MaxMetaspaceSize=1536m -XX:+HeapDumpOnOutOfMemoryError
+
+kotlin.compiler.execution.strategy=in-process
diff --git a/.github/workflows/gradle-btbench.yml b/.github/workflows/gradle-btbench.yml
new file mode 100644
index 0000000..3277d24
--- /dev/null
+++ b/.github/workflows/gradle-btbench.yml
@@ -0,0 +1,33 @@
+name: Gradle Android Build & test
+
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+ paths:
+ - 'extras/android/BtBench/**'
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ timeout-minutes: 40
+
+ steps:
+ - name: Check out from Git
+ uses: actions/checkout@v3
+
+ - name: Set up JDK
+ uses: actions/setup-java@v4
+ with:
+ distribution: 'zulu'
+ java-version: 17
+
+ - name: Setup Gradle
+ uses: gradle/actions/setup-gradle@v3
+
+ - name: Build with Gradle
+ run: cd extras/android/BtBench && ./gradlew build
diff --git a/extras/android/BtBench/.gitignore b/extras/android/BtBench/.gitignore
index aa724b7..87f66f5 100644
--- a/extras/android/BtBench/.gitignore
+++ b/extras/android/BtBench/.gitignore
@@ -1,12 +1,7 @@
*.iml
.gradle
/local.properties
-/.idea/caches
-/.idea/libraries
-/.idea/modules.xml
-/.idea/workspace.xml
-/.idea/navEditor.xml
-/.idea/assetWizardSettings.xml
+.idea/
.DS_Store
/build
/captures
diff --git a/extras/android/BtBench/app/src/main/AndroidManifest.xml b/extras/android/BtBench/app/src/main/AndroidManifest.xml
index 5188159..1349991 100644
--- a/extras/android/BtBench/app/src/main/AndroidManifest.xml
+++ b/extras/android/BtBench/app/src/main/AndroidManifest.xml
@@ -5,6 +5,7 @@
+
diff --git a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/Advertiser.kt b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/Advertiser.kt
index 17d1ade..7205420 100644
--- a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/Advertiser.kt
+++ b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/Advertiser.kt
@@ -6,13 +6,14 @@ import android.bluetooth.le.AdvertiseCallback
import android.bluetooth.le.AdvertiseData
import android.bluetooth.le.AdvertiseSettings
import android.bluetooth.le.AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY
-import android.os.Build
+import androidx.annotation.RequiresApi
import java.util.logging.Logger
private val Log = Logger.getLogger("btbench.advertiser")
class Advertiser(private val bluetoothAdapter: BluetoothAdapter) : AdvertiseCallback() {
@SuppressLint("MissingPermission")
+ @RequiresApi(34)
fun start() {
val advertiseSettingsBuilder = AdvertiseSettings.Builder()
.setAdvertiseMode(ADVERTISE_MODE_LOW_LATENCY)
diff --git a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/GattServer.kt b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/GattServer.kt
index 8a36ecc..a4a024c 100644
--- a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/GattServer.kt
+++ b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/GattServer.kt
@@ -26,6 +26,8 @@ import android.bluetooth.BluetoothGattService
import android.bluetooth.BluetoothManager
import android.bluetooth.BluetoothStatusCodes
import android.content.Context
+import android.os.Build
+import androidx.annotation.RequiresApi
import androidx.core.content.ContextCompat
import java.io.IOException
import java.util.concurrent.CountDownLatch
@@ -174,6 +176,7 @@ class GattServer(
}
}
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
override fun run() {
viewModel.running = true
diff --git a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/L2capServer.kt b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/L2capServer.kt
index 69b31dc..3bfc5c1 100644
--- a/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/L2capServer.kt
+++ b/extras/android/BtBench/app/src/main/java/com/github/google/bumble/btbench/L2capServer.kt
@@ -16,14 +16,9 @@ package com.github.google.bumble.btbench
import android.annotation.SuppressLint
import android.bluetooth.BluetoothAdapter
-import android.bluetooth.le.AdvertiseCallback
-import android.bluetooth.le.AdvertiseData
-import android.bluetooth.le.AdvertiseSettings
-import android.bluetooth.le.AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY
import android.os.Build
-import java.io.IOException
+import androidx.annotation.RequiresApi
import java.util.logging.Logger
-import kotlin.concurrent.thread
private val Log = Logger.getLogger("btbench.l2cap-server")
@@ -34,6 +29,7 @@ class L2capServer(
) : Mode {
private var socketServer: SocketServer? = null
+ @RequiresApi(Build.VERSION_CODES.UPSIDE_DOWN_CAKE)
@SuppressLint("MissingPermission")
override fun run() {
// Advertise so that the peer can find us and connect.