Skip to content

Commit 138ba86

Browse files
Fix Android build (#165)
1 parent 66a4dd5 commit 138ba86

File tree

4 files changed

+18
-17
lines changed

4 files changed

+18
-17
lines changed

android/build.gradle

+9-15
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
def DEFAULT_COMPILE_SDK_VERSION = 35
2-
def DEFAULT_MIN_SDK_VERSION = 26
3-
def DEFAULT_TARGET_SDK_VERSION = 35
4-
def DEFAULT_KOTLIN_VERSION = "2.0.21"
5-
def DEFAULT_AGP_VERSION = "8.7.3"
6-
71
buildscript {
8-
ext.safeExtGet = {prop, fallback ->
9-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2+
ext.safeExtGet = {prop ->
3+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['argyle_plugin_rn_' + prop]
104
}
115
repositories {
126
google()
@@ -16,8 +10,8 @@ buildscript {
1610
dependencies {
1711
// Matches recent template from React Native (0.60)
1812
// https://github.com/facebook/react-native/blob/0.60-stable/template/android/build.gradle#L16
19-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion', DEFAULT_KOTLIN_VERSION)}"
20-
classpath "com.android.tools.build:gradle:${safeExtGet('agpVersion', DEFAULT_AGP_VERSION)}"
13+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}"
14+
classpath "com.android.tools.build:gradle:${safeExtGet('gradlePluginVersion')}"
2115
}
2216
}
2317

@@ -26,11 +20,11 @@ apply plugin: 'com.android.library'
2620
apply plugin: 'kotlin-android'
2721

2822
android {
29-
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
23+
compileSdkVersion safeExtGet('compileSdkVersion')
3024

3125
defaultConfig {
32-
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
33-
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
26+
minSdkVersion safeExtGet('minSdkVersion')
27+
targetSdkVersion safeExtGet('targetSdkVersion')
3428
versionCode 1
3529
versionName "1.0"
3630
}
@@ -51,8 +45,8 @@ repositories {
5145
}
5246

5347
dependencies {
54-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${project.ext.kotlinVersion}"
55-
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion', '+')}"
48+
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${safeExtGet('kotlinVersion')}"
49+
implementation "com.facebook.react:react-native:${safeExtGet('reactnativeVersion')}"
5650
implementation 'com.argyle:argyle-link-android:5.13.0'
5751
}
5852

android/gradle.properties

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
argyle_plugin_rn_kotlinVersion=2.0.21
2+
argyle_plugin_rn_minSdkVersion=26
3+
argyle_plugin_rn_targetSdkVersion=35
4+
argyle_plugin_rn_compileSdkVersion=35
5+
argyle_plugin_rn_gradlePluginVersion=8.7.3
6+
argyle_plugin_rn_reactnativeVersion=+

android/src/main/java/com/reactlibrary/ARArgyleSdkModule.kt

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class ARArgyleSdkModule(context: ReactApplicationContext) : ReactContextBaseJava
5353
LinkError.Type.INCOMPATIBLE_DDS_CONFIG -> "incompatible_dds_config"
5454
LinkError.Type.GIG_ITEMS_NOT_SUPPORTED -> "gig_items_not_supported"
5555
LinkError.Type.BENEFITS_ITEMS_NOT_SUPPORTED -> "benefits_items_not_supported"
56+
LinkError.Type.EXCLUDED_ITEM -> "excluded_item"
5657
LinkError.Type.GENERIC -> "generic"
5758
}
5859

example/android/build.gradle

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ buildscript {
44
compileSdkVersion = 35
55
targetSdkVersion = 35
66
kotlinVersion = "2.0.21"
7-
agpVersion = "8.7.3"
7+
gradlePluginVersion = "8.7.3"
88
}
99
repositories {
1010
google()
1111
mavenCentral()
1212
}
1313
dependencies {
14-
classpath("com.android.tools.build:gradle:$agpVersion")
14+
classpath("com.android.tools.build:gradle:$gradlePluginVersion")
1515
classpath("com.facebook.react:react-native-gradle-plugin")
1616
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
1717
}

0 commit comments

Comments
 (0)