[install] Get react-native link working with Android
This commit is contained in:
parent
69debf7017
commit
3697864f1b
|
@ -88,8 +88,11 @@
|
||||||
"rnpm": {
|
"rnpm": {
|
||||||
"android": {
|
"android": {
|
||||||
"buildPatch": " compile(project(':react-native-firebase')) {\n transitive = false\n }\n",
|
"buildPatch": " compile(project(':react-native-firebase')) {\n transitive = false\n }\n",
|
||||||
"packageImportPath": "import io.invertase.firebase.RNFirebasePackage;\nimport io.invertase.firebase.analytics.RNFirebaseAnalyticsPackage;",
|
"packageImportPath": "import io.invertase.firebase.RNFirebasePackage;",
|
||||||
"packageInstance": "new RNFirebasePackage(),\n new RNFirebaseAnalyticsPackage()"
|
"packageInstance": "new RNFirebasePackage()"
|
||||||
|
},
|
||||||
|
"commands": {
|
||||||
|
"postlink": "node node_modules/react-native-firebase/scripts/rnpm-postlink"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,26 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const appBuildGradlePath = path.join('android', 'app', 'build.gradle');
|
||||||
|
|
||||||
|
const defaultCompileStatement = "compile project(':react-native-firebase')";
|
||||||
|
const requiredCompileStatement = "compile(project(':react-native-firebase')) {\n transitive = false\n }";
|
||||||
|
|
||||||
|
// android/build.gradle
|
||||||
|
// 1) TODO: Add Google Play maven repository
|
||||||
|
|
||||||
|
// 2) TODO: Add google-services dependency if required
|
||||||
|
|
||||||
|
// android/app/build.gradle
|
||||||
|
// 0) Load the file
|
||||||
|
let buildGradleContents = fs.readFileSync(appBuildGradlePath, 'utf8');
|
||||||
|
|
||||||
|
// 1) Check that react-native-firebase compile statement is the correct format
|
||||||
|
buildGradleContents = buildGradleContents.replace(defaultCompileStatement, requiredCompileStatement);
|
||||||
|
|
||||||
|
// 2) TODO: Add firebase-core and play-services-base dependencies
|
||||||
|
|
||||||
|
// 3) TODO: Add google-services plugin
|
||||||
|
|
||||||
|
// 4) Write file
|
||||||
|
fs.writeFileSync(appBuildGradlePath, buildGradleContents);
|
Loading…
Reference in New Issue