Files
self/app/android/build.gradle
2024-10-17 19:15:58 -07:00

80 lines
3.0 KiB
Groovy

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "34.0.0"
minSdkVersion = 23
compileSdkVersion = 34
targetSdkVersion = 34
ndkVersion = "26.1.10909125"
kotlinVersion = "1.9.24"
}
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath("com.facebook.react:react-native-gradle-plugin")
// classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath 'com.android.tools.build:gradle:8.1.0'
classpath 'com.google.gms:google-services:4.3.14'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.2'
classpath 'org.mozilla.rust-android-gradle:plugin:0.9.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
configurations.configureEach {
resolutionStrategy.dependencySubstitution {
substitute(platform(module('com.gemalto.jp2:jp2-android'))) using module('com.github.Tgo1014:JP2ForAndroid:1.0.4')
}
resolutionStrategy.force 'com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava'
}
}
subprojects {
afterEvaluate { project ->
if (project.hasProperty('android')) {
android {
def manifestFile = project.file('src/main/AndroidManifest.xml')
def buildGradleFile = project.file('build.gradle')
if (buildGradleFile.exists()) {
def buildGradleText = buildGradleFile.text
def namespaceMatcher = buildGradleText =~ /namespace\s*['"](.+?)['"]/
if (namespaceMatcher.find()) {
namespace = namespaceMatcher[0][1]
println "Set namespace for ${project.name} to ${namespace} from build.gradle"
return
}
}
if (manifestFile.exists()) {
def manifestText = manifestFile.text
def packageMatcher = manifestText =~ /package="([\w\.]+)"/
if (packageMatcher.find()) {
def packageName = packageMatcher[0][1]
namespace = packageName
println "Set namespace for ${project.name} to ${namespace} from AndroidManifest.xml"
} else {
namespace = project.group
println "No 'package' attribute found. Set namespace for ${project.name} to ${namespace}"
}
} else {
namespace = project.group
println "AndroidManifest.xml not found. Set namespace for ${project.name} to ${namespace}"
}
}
}
}
}
apply plugin: "com.facebook.react.rootproject"