mirror of
https://github.com/vanitasvitae/Smack.git
synced 2024-11-26 14:02:06 +01:00
5dd08fc215
Set RECEIVER_NOT_EXPORTED when registering the receiver in ServerPingWithAlarmManager, as otherwise this will throw an exception if the application targets Android API level 34 or higher. This requires raising the minimum Android API level to 26 for registerReceiver() with flags.
37 lines
1.1 KiB
Groovy
37 lines
1.1 KiB
Groovy
ext {
|
|
javaVersion = JavaVersion.VERSION_11
|
|
javaMajor = javaVersion.getMajorVersion()
|
|
smackMinAndroidSdk = 26
|
|
|
|
androidBootClasspath = { getAndroidRuntimeJar() }
|
|
}
|
|
|
|
repositories {
|
|
mavenLocal()
|
|
mavenCentral()
|
|
}
|
|
|
|
def getAndroidRuntimeJar() {
|
|
def androidApiLevel = ext.smackMinAndroidSdk
|
|
def androidHome = getAndroidHome()
|
|
def androidJar = new File("$androidHome/platforms/android-${androidApiLevel}/android.jar")
|
|
if (androidJar.isFile()) {
|
|
return androidJar
|
|
} else {
|
|
throw new Exception("Can't find android.jar for API level ${androidApiLevel}. Please install corresponding SDK platform package")
|
|
}
|
|
}
|
|
def getAndroidJavadocOffline() {
|
|
def androidHome = getAndroidHome()
|
|
return androidHome.toString() + "/docs/reference"
|
|
}
|
|
|
|
def getAndroidHome() {
|
|
def androidHomeEnv = System.getenv("ANDROID_HOME")
|
|
if (androidHomeEnv == null) {
|
|
throw new Exception("ANDROID_HOME environment variable is not set")
|
|
}
|
|
def androidHome = new File(androidHomeEnv)
|
|
if (!androidHome.isDirectory()) throw new Exception("Environment variable ANDROID_HOME is not pointing to a directory")
|
|
return androidHome
|
|
}
|