react-native-google-places icon indicating copy to clipboard operation
react-native-google-places copied to clipboard

RN 0.60

Open JackThomson2 opened this issue 5 years ago • 4 comments

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

JackThomson2 avatar Jul 12 '19 19:07 JackThomson2

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

yogeverez avatar Jul 14 '19 11:07 yogeverez

Worked for me 👍

craig8two avatar Jul 15 '19 07:07 craig8two

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();

BlenderDude avatar Jul 19 '19 22:07 BlenderDude

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

adujoseph avatar Aug 27 '19 12:08 adujoseph