Skip to content

Commit 0579c50

Browse files
committed
update android folder
1 parent a3b798f commit 0579c50

30 files changed

Lines changed: 125 additions & 527 deletions

android/build.gradle

Lines changed: 41 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,83 @@
11
buildscript {
2-
// Buildscript is evaluated before everything else so we can't use getExtOrDefault
3-
def kotlin_version = rootProject.ext.has('kotlinVersion') ? rootProject.ext.get('kotlinVersion') : rootProject.ext.has('kotlin_version') ? rootProject.ext.get('kotlin_version') : project.properties['Ama_kotlinVersion']
2+
ext.getExtOrDefault = {name ->
3+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Ama_' + name]
4+
}
45

56
repositories {
67
google()
78
mavenCentral()
89
}
910

1011
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.2.1'
12+
classpath "com.android.tools.build:gradle:8.7.2"
1213
// noinspection DifferentKotlinGradleVersion
13-
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
14+
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}"
1415
}
1516
}
1617

17-
apply plugin: 'com.android.library'
18-
apply plugin: 'kotlin-android'
1918

20-
def getExtOrDefault(name) {
21-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Ama_' + name]
22-
}
19+
apply plugin: "com.android.library"
20+
apply plugin: "kotlin-android"
21+
22+
apply plugin: "com.facebook.react"
2323

2424
def getExtOrIntegerDefault(name) {
25-
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['Ama_' + name]).toInteger()
25+
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Ama_" + name]).toInteger()
2626
}
2727

2828
android {
29-
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
29+
namespace "com.ama"
30+
31+
compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
32+
3033
defaultConfig {
31-
minSdkVersion 16
32-
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
33-
versionCode 1
34-
versionName "1.0"
35-
34+
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35+
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
36+
}
37+
38+
buildFeatures {
39+
buildConfig true
3640
}
37-
41+
3842
buildTypes {
3943
release {
4044
minifyEnabled false
4145
}
4246
}
47+
4348
lintOptions {
44-
disable 'GradleCompatible'
49+
disable "GradleCompatible"
4550
}
51+
4652
compileOptions {
4753
sourceCompatibility JavaVersion.VERSION_1_8
4854
targetCompatibility JavaVersion.VERSION_1_8
4955
}
56+
57+
sourceSets {
58+
main {
59+
java.srcDirs += [
60+
"generated/java",
61+
"generated/jni"
62+
]
63+
}
64+
}
5065
}
5166

5267
repositories {
5368
mavenCentral()
5469
google()
55-
56-
def found = false
57-
def defaultDir = null
58-
def androidSourcesName = 'React Native sources'
59-
60-
if (rootProject.ext.has('reactNativeAndroidRoot')) {
61-
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
62-
} else {
63-
defaultDir = new File(
64-
projectDir,
65-
'/../../../node_modules/react-native/android'
66-
)
67-
}
68-
69-
if (defaultDir.exists()) {
70-
maven {
71-
url defaultDir.toString()
72-
name androidSourcesName
73-
}
74-
75-
logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
76-
found = true
77-
} else {
78-
def parentDir = rootProject.projectDir
79-
80-
1.upto(5, {
81-
if (found) return true
82-
parentDir = parentDir.parentFile
83-
84-
def androidSourcesDir = new File(
85-
parentDir,
86-
'node_modules/react-native'
87-
)
88-
89-
def androidPrebuiltBinaryDir = new File(
90-
parentDir,
91-
'node_modules/react-native/android'
92-
)
93-
94-
if (androidPrebuiltBinaryDir.exists()) {
95-
maven {
96-
url androidPrebuiltBinaryDir.toString()
97-
name androidSourcesName
98-
}
99-
100-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
101-
found = true
102-
} else if (androidSourcesDir.exists()) {
103-
maven {
104-
url androidSourcesDir.toString()
105-
name androidSourcesName
106-
}
107-
108-
logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
109-
found = true
110-
}
111-
})
112-
}
113-
114-
if (!found) {
115-
throw new GradleException(
116-
"${project.name}: unable to locate React Native android sources. " +
117-
"Ensure you have you installed React Native as a dependency in your project and try again."
118-
)
119-
}
12070
}
12171

122-
def kotlin_version = getExtOrDefault('kotlinVersion')
72+
def kotlin_version = getExtOrDefault("kotlinVersion")
12373

12474
dependencies {
125-
// noinspection GradleDynamicVersion
126-
api 'com.facebook.react:react-native:+'
75+
implementation "com.facebook.react:react-android"
12776
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
12877
}
78+
79+
react {
80+
jsRootDir = file("../src/")
81+
libraryName = "Ama"
82+
codegenJavaPackageName = "com.ama"
83+
}

android/gradle.properties

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
Ama_kotlinVersion=1.3.50
2-
Ama_compileSdkVersion=29
3-
Ama_targetSdkVersion=29
1+
Ama_kotlinVersion=2.0.21
2+
Ama_minSdkVersion=24
3+
Ama_targetSdkVersion=34
4+
Ama_compileSdkVersion=35
5+
Ama_ndkVersion=27.1.12297006
-58.1 KB
Binary file not shown.

android/gradlew

Lines changed: 0 additions & 185 deletions
This file was deleted.

0 commit comments

Comments
 (0)