File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 11const assert = require ( 'assert' ) ;
22const {
33 withAppBuildGradle,
4+ withGradleProperties,
45 withProjectBuildGradle,
56} = require ( 'expo/config-plugins' ) ;
67
@@ -47,6 +48,7 @@ afterEvaluate {
4748` ;
4849 config . modResults . contents += code ;
4950 }
51+
5052 return config ;
5153 } ) ;
5254} ;
@@ -73,6 +75,34 @@ const withJscAndroidProjectBuildGradle = (config) => {
7375const withJscAndroid = ( config ) => {
7476 config = withJscAndroidAppBuildGradle ( config ) ;
7577 config = withJscAndroidProjectBuildGradle ( config ) ;
78+ config = withGradleProperties ( config , ( config ) => {
79+ const propertyName = 'reactNativeArchitectures' ;
80+ const desiredValue = 'arm64-v8a' ;
81+ const existingProp = config . modResults . find (
82+ ( item ) => item . type === 'property' && item . key === propertyName
83+ ) ;
84+ const cleanValue = ( value ) => {
85+ if ( ! value ) return desiredValue ;
86+ const archs = value
87+ . split ( ',' )
88+ . map ( ( arch ) => arch . trim ( ) )
89+ . filter ( Boolean ) ;
90+ if ( ! archs . length ) return desiredValue ;
91+ const result = archs . filter ( ( arch ) => arch !== 'armeabi-v7a' ) ;
92+ if ( ! result . length ) return desiredValue ;
93+ return Array . from ( new Set ( result ) ) . join ( ',' ) ;
94+ } ;
95+ if ( existingProp ) {
96+ existingProp . value = cleanValue ( existingProp . value ) ;
97+ } else {
98+ config . modResults . push ( {
99+ type : 'property' ,
100+ key : propertyName ,
101+ value : desiredValue ,
102+ } ) ;
103+ }
104+ return config ;
105+ } ) ;
76106 return config ;
77107} ;
78108
You can’t perform that action at this time.
0 commit comments