File tree Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Expand file tree Collapse file tree 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,32 @@ def getExtOrDefault(name) {
33
33
def getExtOrIntegerDefault (name ) {
34
34
return rootProject. ext. has(name) ? rootProject. ext. get(name) : (project. properties[' PagerView_' + name]). toInteger()
35
35
}
36
+ def agpVersion = com.android.Version . ANDROID_GRADLE_PLUGIN_VERSION . tokenize(' .' )[0 ]. toInteger()
37
+ def shouldUseNameSpace = agpVersion >= 8
38
+ def PACKAGE_PROP = " package=\" com.reactnativepagerview\" "
39
+ def manifestOutFile = file(" ${ projectDir} /src/main/AndroidManifest.xml" )
40
+ def manifestContent = manifestOutFile. getText()
41
+ if (shouldUseNameSpace){
42
+ manifestContent = manifestContent. replaceAll(
43
+ PACKAGE_PROP ,
44
+ ' '
45
+ )
46
+ } else {
47
+ if (! manifestContent. contains(" $PACKAGE_PROP " )){
48
+ manifestContent = manifestContent. replace(
49
+ ' <manifest' ,
50
+ " <manifest $PACKAGE_PROP "
51
+ )
52
+ }
53
+ }
54
+ manifestContent. replaceAll(" " , " " )
55
+ manifestOutFile. write(manifestContent)
36
56
37
57
android {
38
58
compileSdkVersion getExtOrIntegerDefault(' compileSdkVersion' )
39
-
59
+ if (shouldUseNameSpace){
60
+ namespace = " com.reactnativepagerview"
61
+ }
40
62
defaultConfig {
41
63
minSdkVersion getExtOrIntegerDefault(' minSdkVersion' )
42
64
targetSdkVersion getExtOrIntegerDefault(' targetSdkVersion' )
You can’t perform that action at this time.
0 commit comments