forked from nonbili/NouTube
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwithAndroidPlugin.ts
More file actions
47 lines (43 loc) · 1.48 KB
/
withAndroidPlugin.ts
File metadata and controls
47 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { ConfigPlugin } from '@expo/config-plugins'
import { withAppBuildGradle } from '@expo/config-plugins/build/plugins/android-plugins.js'
const withAndroidSigningConfig: ConfigPlugin = (config) => {
return withAppBuildGradle(config, (config) => {
// https://www.reddit.com/r/expo/comments/1j4v323/comment/mit9b2a/
config.modResults.contents = config.modResults.contents
.replace(
'android {',
`ext.abiCodes = [x86:1, x86_64:2, 'armeabi-v7a':3, 'arm64-v8a': 4]
android {`,
)
.replace(
/buildTypes \{([\s\S]*?)release \{([\s\S]*?)signingConfig signingConfigs\.debug/,
`buildTypes {$1release { `,
)
.replace(
/androidResources \{([\s\S]*?)}/,
`androidResources {$1}
dependenciesInfo {
includeInApk = false
includeInBundle = false
}
splits {
abi {
reset()
enable true
universalApk false
include project.ext.abiCodes.keySet() as String[]
}
}
android.applicationVariants.configureEach { variant ->
variant.outputs.each { output ->
def baseAbiVersionCode = project.ext.abiCodes.get(output.getFilter(com.android.build.OutputFile.ABI))
if (baseAbiVersionCode != null) {
output.versionCodeOverride = (100 * project.android.defaultConfig.versionCode) + baseAbiVersionCode
}
}
}`,
)
return config
})
}
export default withAndroidSigningConfig