safeExtGet looks for parameters in the wrong location
plaa opened this issue · 1 comments
It seems to me that safeExtGet
in android/build.gradle
looks for parameters in the wrong place. It looks for example for rootProject.ext.minSdkVersion
. When I print out variables of a library during an Android app build, rootProject.ext.minSdkVersion
is undefined but rootProject.minSdkVersion
contains the expected value.
I ran into this when debugging this build issue. The first library I fixed had hard-coded the minSdkVersion and I changed it to read rootProject.minSdkVersion
and it works fine. The next library read it from rootProject.ext.minSdkVersion
which caused it to use the default value. When I change it to use rootProject.minSdkVersion
it works as fine.
To reproduce, add following lines to node_modules/<react-native-some-library>/android/build.gradle
and run an app build:
println "minSdkVersion"
println rootProject.ext.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 0
println rootProject.hasProperty('minSdkVersion') ? rootProject.minSdkVersion : 0
Sorry, I misread the generated code. The generated code uses has
instead of hasProperty
, which works as expected.