Skip to content

Commit c4c1617

Browse files
committed
Fix android compilation with ndk older than r19
[ci skip]
1 parent 59896f5 commit c4c1617

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

gframe/Android/COSAndroidOperator.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,19 @@
55
#endif
66

77
#include <sys/utsname.h>
8+
#include <android/ndk-version.h>
9+
#if __NDK_MAJOR__ >= 19
810
#include <android/api-level.h>
11+
#else
12+
#include <sys/system_properties.h>
13+
#include <cstdlib>
14+
static inline int android_get_device_api_level() {
15+
char value[92] = { 0 };
16+
if (__system_property_get("ro.build.version.sdk", value) < 1) return -1;
17+
int api_level = std::atoi(value);
18+
return (api_level > 0) ? api_level : -1;
19+
}
20+
#endif
921
#include "COSAndroidOperator.h"
1022
#include "porting_android.h"
1123

0 commit comments

Comments
 (0)