1
1
buildscript {
2
- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
3
2
def kotlin_version = rootProject. ext. has(' kotlinVersion' ) ? rootProject. ext. get(' kotlinVersion' ) : project. properties[' QueueIt_kotlinVersion' ]
4
3
5
4
repositories {
6
5
mavenCentral()
7
- mavenLocal()
8
6
google()
7
+ maven{
8
+ url " https://repo1.maven.org/maven2/"
9
+ }
10
+ maven {
11
+ url " https://maven.google.com"
12
+ }
13
+ mavenLocal()
9
14
}
10
15
11
16
dependencies {
12
- classpath ' com.android.tools.build:gradle:4.1.3'
13
- // noinspection DifferentKotlinGradleVersion
17
+ classpath ' com.android.tools.build:gradle:8.3.2'
14
18
classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
15
19
}
16
20
}
17
21
18
- apply plugin : ' com.android.library'
19
- apply plugin : ' kotlin-android'
22
+ plugins {
23
+ id ' com.android.library'
24
+ id ' com.facebook.react'
25
+ id ' kotlin-android'
26
+ }
20
27
21
28
def getExtOrDefault (name ) {
22
29
return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[' QueueIt_' + name]
@@ -27,16 +34,32 @@ def getExtOrIntegerDefault(name) {
27
34
}
28
35
29
36
android {
37
+ namespace " com.reactnativequeueit"
30
38
compileSdkVersion getExtOrIntegerDefault(' compileSdkVersion' )
31
- buildToolsVersion getExtOrDefault(' buildToolsVersion' )
39
+ buildFeatures {
40
+ prefab true
41
+ }
32
42
defaultConfig {
33
- minSdkVersion 21
43
+ minSdkVersion 24
34
44
targetSdkVersion getExtOrIntegerDefault(' targetSdkVersion' )
35
45
versionCode 1
36
46
versionName " 1.0"
37
47
38
- }
48
+ externalNativeBuild {
49
+ cmake {
50
+ cppFlags " -std=c++17"
51
+ arguments " -DANDROID_STL=c++_shared" ,
52
+ " -DCMAKE_OBJECT_PATH_MAX=1024" ,
53
+ " -DANDROID_SUPPORT_FLEXIBLE_PAGE_SIZES=ON" ,
54
+ " -DREACT_NATIVE_DIR=${ rootProject.projectDir} /../node_modules/react-native" ,
55
+ " -DCODEGEN_DIR=${ buildDir} /generated/source/codegen/jni"
56
+ }
57
+ }
39
58
59
+ ndk {
60
+ abiFilters " armeabi-v7a" , " arm64-v8a" , " x86_64"
61
+ }
62
+ }
40
63
buildTypes {
41
64
release {
42
65
minifyEnabled false
@@ -45,92 +68,28 @@ android {
45
68
lintOptions {
46
69
disable ' GradleCompatible'
47
70
}
48
- compileOptions {
49
- sourceCompatibility JavaVersion . VERSION_1_8
50
- targetCompatibility JavaVersion . VERSION_1_8
51
- }
52
- }
53
-
54
- repositories {
55
- mavenCentral()
56
- mavenLocal()
57
- google()
58
-
59
- def found = false
60
- def defaultDir = null
61
- def androidSourcesName = ' React Native sources'
62
-
63
- if (rootProject. ext. has(' reactNativeAndroidRoot' )) {
64
- defaultDir = rootProject. ext. get(' reactNativeAndroidRoot' )
65
- } else {
66
- defaultDir = new File (
67
- projectDir,
68
- ' /../../../node_modules/react-native/android'
69
- )
70
- }
71
-
72
- if (defaultDir. exists()) {
73
- maven {
74
- url defaultDir. toString()
75
- name androidSourcesName
71
+ externalNativeBuild {
72
+ cmake {
73
+ path " src/main/jni/CMakeLists.txt"
76
74
}
77
-
78
- logger. info(" :${ project.name} :reactNativeAndroidRoot ${ defaultDir.canonicalPath} " )
79
- found = true
80
- } else {
81
- def parentDir = rootProject. projectDir
82
-
83
- 1. upto(5 , {
84
- if (found) return true
85
- parentDir = parentDir. parentFile
86
-
87
- def androidSourcesDir = new File (
88
- parentDir,
89
- ' node_modules/react-native'
90
- )
91
-
92
- def androidPrebuiltBinaryDir = new File (
93
- parentDir,
94
- ' node_modules/react-native/android'
95
- )
96
-
97
- if (androidPrebuiltBinaryDir. exists()) {
98
- maven {
99
- url androidPrebuiltBinaryDir. toString()
100
- name androidSourcesName
101
- }
102
-
103
- logger. info(" :${ project.name} :reactNativeAndroidRoot ${ androidPrebuiltBinaryDir.canonicalPath} " )
104
- found = true
105
- } else if (androidSourcesDir. exists()) {
106
- maven {
107
- url androidSourcesDir. toString()
108
- name androidSourcesName
109
- }
110
-
111
- logger. info(" :${ project.name} :reactNativeAndroidRoot ${ androidSourcesDir.canonicalPath} " )
112
- found = true
113
- }
114
- })
115
75
}
116
-
117
- if (! found) {
118
- throw new GradleException (
119
- " ${ project.name} : unable to locate React Native android sources. " +
120
- " Ensure you have you installed React Native as a dependency in your project and try again."
121
- )
76
+ sourceSets {
77
+ main {
78
+ java. srcDirs + = " $buildDir /generated/source/codegen/java"
79
+ jniLibs. srcDirs + = " $buildDir /generated/source/codegen/jni"
80
+ }
122
81
}
123
82
}
124
83
125
84
def kotlin_version = getExtOrDefault(' kotlinVersion' )
126
-
127
85
dependencies {
128
- // noinspection GradleDynamicVersion
129
- api ' com.facebook.react:react-native:+'
130
86
implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
131
87
88
+ implementation(libs. react. android)
89
+ implementation(libs. fbjni)
90
+
132
91
// App dependencies
133
- implementation ' com.queue-it.androidsdk:library:2.0.36'
134
- implementation ' com.android.support:appcompat-v7:28.0.0'
135
- implementation ' com.android.support:design:28.0.0'
92
+ implementation( ' com.queue-it.androidsdk:library:2.0.36' )
93
+ implementation( ' com.android.support:appcompat-v7:28.0.0' )
94
+ implementation( ' com.android.support:design:28.0.0' )
136
95
}
0 commit comments