11buildscript {
2- // Buildscript is evaluated before everything else so we can't use getExtOrDefault
32 def kotlin_version = rootProject. ext. has(' kotlinVersion' ) ? rootProject. ext. get(' kotlinVersion' ) : project. properties[' QueueIt_kotlinVersion' ]
43
54 repositories {
65 mavenCentral()
7- mavenLocal()
86 google()
7+ maven{
8+ url " https://repo1.maven.org/maven2/"
9+ }
10+ maven {
11+ url " https://maven.google.com"
12+ }
13+ mavenLocal()
914 }
1015
1116 dependencies {
12- classpath ' com.android.tools.build:gradle:4.1.3'
13- // noinspection DifferentKotlinGradleVersion
17+ classpath ' com.android.tools.build:gradle:8.3.2'
1418 classpath " org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version "
1519 }
1620}
1721
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+ }
2027
2128def getExtOrDefault (name ) {
2229 return rootProject. ext. has(name) ? rootProject. ext. get(name) : project. properties[' QueueIt_' + name]
@@ -27,16 +34,32 @@ def getExtOrIntegerDefault(name) {
2734}
2835
2936android {
37+ namespace " com.reactnativequeueit"
3038 compileSdkVersion getExtOrIntegerDefault(' compileSdkVersion' )
31- buildToolsVersion getExtOrDefault(' buildToolsVersion' )
39+ buildFeatures {
40+ prefab true
41+ }
3242 defaultConfig {
33- minSdkVersion 21
43+ minSdkVersion 24
3444 targetSdkVersion getExtOrIntegerDefault(' targetSdkVersion' )
3545 versionCode 1
3646 versionName " 1.0"
3747
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+ }
3958
59+ ndk {
60+ abiFilters " armeabi-v7a" , " arm64-v8a" , " x86_64"
61+ }
62+ }
4063 buildTypes {
4164 release {
4265 minifyEnabled false
@@ -45,92 +68,28 @@ android {
4568 lintOptions {
4669 disable ' GradleCompatible'
4770 }
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"
7674 }
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- })
11575 }
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+ }
12281 }
12382}
12483
12584def kotlin_version = getExtOrDefault(' kotlinVersion' )
126-
12785dependencies {
128- // noinspection GradleDynamicVersion
129- api ' com.facebook.react:react-native:+'
13086 implementation " org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version "
13187
88+ implementation(libs. react. android)
89+ implementation(libs. fbjni)
90+
13291 // 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' )
13695}
0 commit comments