Open THPubs opened 7 years ago
I have the same problem
Removing
compile 'com.google.android.gms:play-services-base:+'
from build.gradle fixed it for me
Did anybody manage to solve this?
@acerbetti Doing that only didn't helped in my case :-(
@acerbetti's solution worked for me, I just had to remove this line from node_modules/react-native-firestack/android/build.gradle
and it started working again:
compile 'com.google.android.gms:play-services-base:+'
But remove that line from a node_modules
package by hand everytime you install the dependencies is not a definitive solution, so I wrote this postinstall
npm script:
fs = require('fs');
const FIRESTACK_GRADLE_FILE = 'node_modules/react-native-firestack/android/build.gradle';
fs.readFile(FIRESTACK_GRADLE_FILE, 'utf-8', (err, data) => {
if (err) {
throw err;
}
let fileLines = data.split('\n');
lastIndex = (() => {
for (let i = fileLines.length - 1; i > -1; i--) {
if (fileLines[i].match('compile \'com.google.android.gms:play-services-base')) {
return i;
}
}
})();
delete fileLines[lastIndex];
fs.writeFile(FIRESTACK_GRADLE_FILE, fileLines.join('\n'), (err, data) => {
if (err) {
return console.log(err);
}
console.log('Firestack dependence fixed.');
});
});
Of course, you have to add this line to the package.json
in order to ask npm
to run it everytime you finish installing a package:
"scripts": {
"postinstall": "node fix-firestack.js"
}
Dummy but it worked.
What do we need that package for? Can we just simple do a PR to remove it from the project ?
@rodrigocurbelo thanks for the script, it works for me
Removing the dependency in the module did not result in a compiled build. Is there another workaround for this? I cannot even run a successful build.
^ follow up from earlier. I build a new react-native app and added only this module with the above:
compile 'com.google.android.gms:play-services-base:+'
removed and it compiled without error.
Downgrade to react-native-firestack@2.3.2
with build.gradle :
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'com.google.firebase:firebase-auth:10.2.0'
fixed it for me
This happens when you have multiple packages requiring different versions of play services. The best way to fix is to make your build.gradle look similar to this
compile(project(':react-native-firestack')){
exclude group: 'com.google.android.gms'
exclude group: "com.google.firebase"
}
// your other libraries with similar exclude lines
compile ("com.google.android.gms:play-services-base:10.0.1") {
force = true;
}
compile ('com.google.firebase:firebase-core:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-auth:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-analytics:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-database:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-storage:10.0.1') {
force = true;
}
compile ('com.google.firebase:firebase-messaging:10.0.1') {
force = true;
}
In my case the problem was with react-native-maps and the @cridenour solution has worked for me.
Reactive-native-maps has the same solution in its web.
My build.gradle looks like this:
.....
dependencies {
compile(project(':react-native-firestack')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
compile "com.facebook.react:react-native:+" // From node_modules
compile(project(':react-native-maps')){
exclude group: 'com.google.android.gms', module: 'play-services-base'
exclude group: 'com.google.android.gms', module: 'play-services-maps'
}
compile 'com.google.android.gms:play-services-base:10.0.1'
compile 'com.google.android.gms:play-services-maps:10.0.1'
}
....
This error is mainly encountered when you have different versions of a particular service. for example:
'com.google.android.gms:play-services-maps:11.0.4'
'compile 'com.google.android.gms:play-services-geo-location:10.0.1'
'compile 'com.google.android.gms:play-services-analytics:13.0.2'
Hope i solved your problem. Thank you!
Just use
implementation 'com.google.android.gms:play-services:12.0.1'
Hope this solved your problem.
Thank you!
Hi, I'm trying to add the this package to my app. But it keeps giving the following error :
I tried to add some packages to
exclude group
in several packages. But none worked. Here's the./gradlew clean :app:dependencies
result: https://gist.github.com/THPubs/8fe8b4b9c80e3c6cd49541d66887c742Tried to follow other similar stack overflow question but looks like this package has a lot of dependencies. I was unable to find the conflict.
My
build.gradle
dependencies: