react-native-google-places
react-native-google-places copied to clipboard
RN 0.60
Hi,
First of all thanks for the great library I've been a long time user.
I am having issues building with android on React Native 0.60 (AndroidX) I am getting the following issues. I have used the jetifier tool to try and update it still with issues. The app also builds successfully without this library.
Here is the error I get if that's helpful:
Cannot find a version of 'androidx.appcompat:appcompat' that satisfies the version constraints:
Many Thanks Jack
You should replace the following lines in build.gradle:
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}"
with those:
implementation "androidx.appcompat:appcompat:1.0.2"
implementation "androidx.legacy:legacy-support-v4:1.0.0"
then, run npx jetify
Worked for me 👍
As great as 0.60 is, there are so many of these tiny file errors that need fixing so I created a file that manages them all for me. Here is the code I am using for this specific fix. I run this as a postinstall
script right before npx jetify
. Hope this helps!
/* eslint quotes: 0 */
const fs = require("fs");
const path = require("path");
function fixReactNativeGooglePlaces() {
const file = path.join(
__dirname,
"/node_modules/react-native-google-places/android/build.gradle"
);
const res = fs.readFileSync(file).toString("utf8");
const fixed = res
.replace(
'implementation "com.android.support:appcompat-v7:${supportLibVersion}"',
'implementation "androidx.appcompat:appcompat:1.0.2"'
)
.replace(
'implementation "com.android.support:support-v4:${supportLibVersion}"',
'implementation "androidx.legacy:legacy-support-v4:1.0.0"'
);
fs.writeFileSync(file, fixed);
}
fixReactNativeGooglePlaces();
Hi,
First of all thanks for the great library I've been a long time user.
I am having issues building with android on React Native 0.60 (AndroidX) I am getting the following issues. I have used the jetifier tool to try and update it still with issues. The app also builds successfully without this library.
Here is the error I get if that's helpful:
Cannot find a version of 'androidx.appcompat:appcompat' that satisfies the version constraints:
Many Thanks Jack
Did you use react-native link react-native-google-places? while setting up. i seem to have an issue using that with RN0.60