1- def buildAsLibrary = project. hasProperty(' BUILD_AS_LIBRARY' );
2- def buildAsApplication = ! buildAsLibrary
3- if (buildAsApplication) {
4- apply plugin : ' com.android.application'
5- }
6- else {
7- apply plugin : ' com.android.library'
1+ plugins {
2+ id ' com.android.application'
83}
94
5+ def buildWithCMake = project. hasProperty(' BUILD_WITH_CMAKE' );
6+
107android {
11- compileSdkVersion 31
8+ namespace = " com.borealis.demo"
9+ compileSdkVersion 35
1210 defaultConfig {
13- if (buildAsApplication) {
14- applicationId " com.borealis.demo"
15- }
16- minSdkVersion 16
17- targetSdkVersion 31
11+ minSdkVersion 21
12+ targetSdkVersion 35
1813 versionCode 1
1914 versionName " 1.0"
20- // borealis need at least ndk r22 (r21 don't have std::filesystem support)
21- // The newer NDK library will cause lower versions of Android failed to run.
22- // r26: support api21 and later
23- // r24/r25: support api19 and later
24- // r22/23: support api16 and later
25- ndkVersion " 22.1.7171670"
2615 externalNativeBuild {
27- cmake {
28- arguments " -DANDROID_APP_PLATFORM=android-16" , " -DANDROID_STL=c++_static"
29- // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
30- abiFilters ' arm64-v8a'
31- version = ' 3.16.0+'
32- }
16+ ndkBuild {
17+ arguments " APP_PLATFORM=android-21"
18+ // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
19+ abiFilters ' arm64-v8a'
20+ }
21+ cmake {
22+ arguments " -DANDROID_PLATFORM=android-21" , " -DANDROID_STL=c++_static"
23+ // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
24+ abiFilters ' arm64-v8a'
25+ }
3326 }
3427 }
3528 buildTypes {
@@ -40,37 +33,23 @@ android {
4033 }
4134 applicationVariants. all { variant ->
4235 tasks[" merge${ variant.name.capitalize()} Assets" ]
43- .dependsOn(" externalNativeBuild${ variant.name.capitalize()} " )
36+ .dependsOn(" externalNativeBuild${ variant.name.capitalize()} " )
4437 }
4538 if (! project. hasProperty(' EXCLUDE_NATIVE_LIBS' )) {
4639 sourceSets. main {
4740 jniLibs. srcDir ' libs'
4841 }
4942 externalNativeBuild {
50- cmake {
51- path ' jni/CMakeLists.txt'
52- version = ' 3.16.0+'
53- }
54- }
55-
56- }
57- lintOptions {
58- abortOnError false
59- }
60-
61- if (buildAsLibrary) {
62- libraryVariants. all { variant ->
63- variant. outputs. each { output ->
64- def outputFile = output. outputFile
65- if (outputFile != null && outputFile. name. endsWith(" .aar" )) {
66- def fileName = " org.libsdl.app.aar" ;
67- output. outputFile = new File (outputFile. parent, fileName);
68- }
43+ cmake {
44+ path ' jni/CMakeLists.txt'
6945 }
7046 }
7147 }
48+ lint {
49+ abortOnError = false
50+ }
7251}
7352
7453dependencies {
7554 implementation fileTree(include : [' *.jar' ], dir : ' libs' )
76- }
55+ }
0 commit comments