Skip to content

Commit 447a39c

Browse files
InfoDevkotalawnjelly
authored andcommitted
set minsdk to 21. Sorted the fseeko error.
(cherry picked from commit e9525ae)
1 parent a8ebc6e commit 447a39c

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

platform/android/detect.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def get_opts():
2121

2222
return [
2323
("ANDROID_SDK_ROOT", "Path to the Android SDK", get_env_android_sdk_root()),
24-
("ndk_platform", 'Target platform (android-<api>, e.g. "android-24")', "android-24"),
24+
("ndk_platform", 'Target platform (android-<api>, e.g. "android-21")', "android-21"),
2525
EnumVariable("android_arch", "Target architecture", "armv7", ("armv7", "arm64v8", "x86", "x86_64")),
2626
BoolVariable("android_neon", "Enable NEON support (armv7 only)", True),
2727
BoolVariable("store_release", "Editor build for Google Play Store (for official builds only)", False),
@@ -176,7 +176,9 @@ def configure(env):
176176
CCFLAGS="-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -fvisibility=hidden -fno-strict-aliasing".split()
177177
)
178178
env.Append(CPPDEFINES=["NO_STATVFS", "GLES_ENABLED"])
179-
env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)])
179+
180+
if get_min_sdk_version(env["ndk_platform"]) >= 24:
181+
env.Append(CPPDEFINES=[("_FILE_OFFSET_BITS", 64)])
180182

181183
env["neon_enabled"] = False
182184
if env["android_arch"] == "x86":

platform/android/export/export_plugin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static const int EXPORT_FORMAT_AAB = 1;
226226
static const char *APK_ASSETS_DIRECTORY = "res://android/build/assets";
227227
static const char *AAB_ASSETS_DIRECTORY = "res://android/build/assetPackInstallTime/src/main/assets";
228228

229-
static const int DEFAULT_MIN_SDK_VERSION = 24; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
229+
static const int DEFAULT_MIN_SDK_VERSION = 21; // Should match the value in 'platform/android/java/app/config.gradle#minSdk'
230230
static const int DEFAULT_TARGET_SDK_VERSION = 35; // Should match the value in 'platform/android/java/app/config.gradle#targetSdk'
231231

232232
#ifndef ANDROID_ENABLED

platform/android/java/app/config.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ext.versions = [
22
androidGradlePlugin: '8.6.1',
33
compileSdk : 35,
4-
minSdk : 24, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
4+
minSdk : 21, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_MIN_SDK_VERSION'
55
targetSdk : 35, // Also update 'platform/android/export/export_plugin.cpp#DEFAULT_TARGET_SDK_VERSION'
66
buildTools : '35.0.0',
77
kotlinVersion : '2.1.20',
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
diff --git a/thirdparty/opus/stream.c b/thirdparty/opus/stream.c
2+
index 0238a6b31b..ef1667a7b6 100644
3+
--- a/thirdparty/opus/stream.c
4+
+++ b/thirdparty/opus/stream.c
5+
@@ -96,6 +96,9 @@ static int op_fseek(void *_stream,opus_int64 _offset,int _whence){
6+
if(pos<0||_offset<-pos||_offset>OP_INT64_MAX-pos)return -1;
7+
pos+=_offset;
8+
return fsetpos((FILE *)_stream,(fpos_t *)&pos);
9+
+#elif defined(__ANDROID__) && __ANDROID_API__ < 24
10+
+ /*fseeko is not available on Android API < 24, use 32-bit fseek instead.*/
11+
+ return fseek((FILE *)_stream,(long)_offset,_whence);
12+
#else
13+
/*This function actually conforms to the SUSv2 and POSIX.1-2001, so we prefer
14+
it except on Windows.*/
15+
@@ -111,6 +114,9 @@ static opus_int64 op_ftell(void *_stream){
16+
opus_int64 pos;
17+
OP_ASSERT(sizeof(pos)==sizeof(fpos_t));
18+
return fgetpos((FILE *)_stream,(fpos_t *)&pos)?-1:pos;
19+
+#elif defined(__ANDROID__) && __ANDROID_API__ < 24
20+
+ /*ftello is not available on Android API < 24, use 32-bit ftell instead.*/
21+
+ return ftell((FILE *)_stream);
22+
#else
23+
/*This function actually conforms to the SUSv2 and POSIX.1-2001, so we prefer
24+
it except on Windows.*/

thirdparty/opus/stream.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ static int op_fseek(void *_stream,opus_int64 _offset,int _whence){
9696
if(pos<0||_offset<-pos||_offset>OP_INT64_MAX-pos)return -1;
9797
pos+=_offset;
9898
return fsetpos((FILE *)_stream,(fpos_t *)&pos);
99+
#elif defined(__ANDROID__) && __ANDROID_API__ < 24
100+
/*fseeko is not available on Android API < 24, use 32-bit fseek instead.*/
101+
return fseek((FILE *)_stream,(long)_offset,_whence);
99102
#else
100103
/*This function actually conforms to the SUSv2 and POSIX.1-2001, so we prefer
101104
it except on Windows.*/
@@ -111,6 +114,9 @@ static opus_int64 op_ftell(void *_stream){
111114
opus_int64 pos;
112115
OP_ASSERT(sizeof(pos)==sizeof(fpos_t));
113116
return fgetpos((FILE *)_stream,(fpos_t *)&pos)?-1:pos;
117+
#elif defined(__ANDROID__) && __ANDROID_API__ < 24
118+
/*ftello is not available on Android API < 24, use 32-bit ftell instead.*/
119+
return ftell((FILE *)_stream);
114120
#else
115121
/*This function actually conforms to the SUSv2 and POSIX.1-2001, so we prefer
116122
it except on Windows.*/

0 commit comments

Comments
 (0)