mirror of
https://github.com/syncthing/syncthing-android.git
synced 2024-12-22 10:51:28 +00:00
Compile and target SDK version 31, increase min Sdk to 21 (#1864)
The upgraded compile SDK requires an upgrade of gradle, which introduces a build error with api lvl <21: > Error while processing [...]/app/src/main/res/drawable/ic_close_24dp.xml : Invalid color value ?attr/colorControlNormal Explanation: https://stackoverflow.com/a/49501629 Also minor NDK update
This commit is contained in:
parent
21b00edfcc
commit
2942072594
6 changed files with 24 additions and 22 deletions
|
@ -26,8 +26,8 @@ dependencies {
|
|||
|
||||
android {
|
||||
// Changes to these values need to be reflected in `../docker/Dockerfile`
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion '30.0.0'
|
||||
compileSdkVersion 31
|
||||
buildToolsVersion '31.0.0'
|
||||
ndkVersion = "${ndkVersionShared}"
|
||||
|
||||
buildTypes.debug.applicationIdSuffix ".debug"
|
||||
|
@ -40,8 +40,8 @@ android {
|
|||
}
|
||||
defaultConfig {
|
||||
applicationId "com.nutomic.syncthingandroid"
|
||||
minSdkVersion 16
|
||||
targetSdkVersion 30
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionCode 4327
|
||||
versionName "1.22.2-rc.3"
|
||||
testApplicationId 'com.nutomic.syncthingandroid.test'
|
||||
|
|
|
@ -57,6 +57,15 @@ public class RestApi {
|
|||
|
||||
private static final String TAG = "RestApi";
|
||||
|
||||
private static final SimpleDateFormat dateFormat;
|
||||
static {
|
||||
if (android.os.Build.VERSION.SDK_INT < 24) {
|
||||
dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
|
||||
} else {
|
||||
dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares folders by labels, uses the folder ID as fallback if the label is empty
|
||||
*/
|
||||
|
@ -276,7 +285,7 @@ public class RestApi {
|
|||
remoteIgnoredDevice.deviceID = deviceId;
|
||||
remoteIgnoredDevice.address = deviceAddress;
|
||||
remoteIgnoredDevice.name = deviceName;
|
||||
remoteIgnoredDevice.time = dateString(new Date());
|
||||
remoteIgnoredDevice.time = dateFormat.format(new Date());
|
||||
mConfig.remoteIgnoredDevices.add(remoteIgnoredDevice);
|
||||
sendConfig();
|
||||
Log.d(TAG, "Ignored device [" + deviceId + "]");
|
||||
|
@ -310,7 +319,7 @@ public class RestApi {
|
|||
IgnoredFolder ignoredFolder = new IgnoredFolder();
|
||||
ignoredFolder.id = folderId;
|
||||
ignoredFolder.label = folderLabel;
|
||||
ignoredFolder.time = dateString(new Date());
|
||||
ignoredFolder.time = dateFormat.format(new Date());
|
||||
device.ignoredFolders.add(ignoredFolder);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Log.v(TAG, "device.ignoredFolders = " + new Gson().toJson(device.ignoredFolders));
|
||||
|
@ -718,8 +727,4 @@ public class RestApi {
|
|||
}
|
||||
}
|
||||
|
||||
private String dateString(Date date) {
|
||||
return new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX").format(date);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -4,14 +4,14 @@ buildscript {
|
|||
ext {
|
||||
// Cannot be called "ndkVersion" as that leads to naming collision
|
||||
// Changes to this value must be reflected in `./docker/Dockerfile`
|
||||
ndkVersionShared = '23.0.7599858'
|
||||
ndkVersionShared = '23.2.8568313'
|
||||
}
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:4.0.1'
|
||||
classpath 'com.android.tools.build:gradle:7.3.1'
|
||||
classpath 'com.github.ben-manes:gradle-versions-plugin:0.36.0'
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
|
|
|
@ -2,9 +2,9 @@ FROM openjdk:11
|
|||
|
||||
ENV GO_VERSION 1.19.3
|
||||
|
||||
ARG ANDROID_SDK_VERSION=7583922
|
||||
ARG ANDROID_SDK_FILENAME=commandlinetools-linux-${ANDROID_SDK_VERSION}_latest.zip
|
||||
|
||||
# Can be found scrolling down on this page:
|
||||
# https://developer.android.com/studio/index.html#command-tools
|
||||
ARG ANDROID_SDK_FILENAME=commandlinetools-linux-9123335_latest.zip
|
||||
WORKDIR /opt
|
||||
|
||||
# Install Go
|
||||
|
@ -26,11 +26,11 @@ ARG SDKMANAGER="${ANDROID_HOME}/cmdline-tools/bin/sdkmanager --sdk_root=${ANDROI
|
|||
# Accept the SDK license, as we can't install packages otherwise
|
||||
RUN yes | $SDKMANAGER --licenses > /dev/null
|
||||
|
||||
# NDK version (r22 fails to build)
|
||||
ENV NDK_VERSION 23.0.7599858
|
||||
# NDK version
|
||||
ENV NDK_VERSION 23.2.8568313
|
||||
|
||||
# Install other android packages, including NDK
|
||||
RUN $SDKMANAGER tools platform-tools "build-tools;29.0.3" "platforms;android-29" "extras;android;m2repository" "ndk;${NDK_VERSION}"
|
||||
RUN $SDKMANAGER tools platform-tools "build-tools;31.0.0" "platforms;android-31" "extras;android;m2repository" "ndk;${NDK_VERSION}"
|
||||
|
||||
# Accept licenses of newly installed packages
|
||||
RUN yes | $SDKMANAGER --licenses
|
||||
|
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
|
|
|
@ -25,7 +25,6 @@ BUILD_TARGETS = [
|
|||
'goarch': 'arm64',
|
||||
'jni_dir': 'arm64-v8a',
|
||||
'cc': 'aarch64-linux-android21-clang',
|
||||
'min_sdk': 21,
|
||||
},
|
||||
{
|
||||
'arch': 'x86',
|
||||
|
@ -38,7 +37,6 @@ BUILD_TARGETS = [
|
|||
'goarch': 'amd64',
|
||||
'jni_dir': 'x86_64',
|
||||
'cc': 'x86_64-linux-android21-clang',
|
||||
'min_sdk': 21,
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -88,7 +86,6 @@ subprocess.check_call([
|
|||
])
|
||||
|
||||
for target in BUILD_TARGETS:
|
||||
target_min_sdk = str(target.get('min_sdk', min_sdk))
|
||||
|
||||
print('Building syncthing for', target['arch'])
|
||||
|
||||
|
|
Loading…
Reference in a new issue