amplitude / Amplitude-ReactNative

Official Amplitude React Native SDK
MIT License
82 stars 21 forks source link

Support React Native 0.70.x #148

Closed ghost closed 2 years ago

ghost commented 2 years ago

I can't build Android:

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/i/all_work/thera/mobile/node_modules/@amplitude/react-native/android/build.gradle' line: 14

* What went wrong:
A problem occurred evaluating project ':amplitude_react-native'.
> Failed to apply plugin 'com.android.internal.library'.
   > The option 'android.jetifier.blacklist' is deprecated.
     It was removed in version 7.0 of the Android Gradle plugin.
     This property has been replaced by android.jetifier.ignorelist
kevinpagtakhan commented 2 years ago

Hi @davydspotnana thank you for choosing Amplitude. Since react-native@0.70 is fairly new, we have not had the time to test it against this version. I'll put in a request to the team to look into this further. To set better expectations, Amplitude rolled out a new Analytics SDK for React Native a couple months back, which we'll provide better support moving forward.

retyui commented 2 years ago

@kevinpagtakhan Could you please add a warning so people who use rnx-dep-check will know that is better to use alternative library

see example: https://github.com/microsoft/rnx-kit/blob/c5b9f851bf3921f7ebbb537b1016d0a364a08797/packages/dep-check/src/presets/banned.ts#L4-L9

yuhao900914 commented 2 years ago

Hi @davydspotnana , I built a brand new rn example with npx react-native init AwesomeProject --version 0.70.3 and install the amplitude library the same as you. "@amplitude/react-native": "^2.16.0".

I'm thinking that issue might be caused by the Gradle and android Gradle plugin compatibility problem between your react-native project with @amplitude/react-native. Can you also share what's your Gradle and android Gradle plugin version?

Provide all the versions on my worked example as a reference: "@amplitude/react-native": "^2.16.0", "react-native": "0.70.3", Android Gradle Plugin: "7.2.1" Gradle: "7.5.1"

Screen Shot 2022-10-22 at 1 28 24 AM
retyui commented 2 years ago

How can I find these settings above ? @yuhao900914

yuhao900914 commented 2 years ago

@retyui In the Android Studio, go to File > Project Structure > Project.

retyui commented 2 years ago

the same (

@yuhao900914

Screenshot 2022-10-26 at 23 13 04
yuhao900914 commented 2 years ago

@retyui I created a repo for my worked example. Can you take look if that helps or run on your local to see if the build can pass?

retyui commented 2 years ago

success:

> Task :app:installDebug
Installing APK 'app-debug.apk' on 'Pixel_API_30(AVD) - 11' for :app:debug
Installed on 1 device.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 1m 51s
55 actionable tasks: 55 executed
yuhao900914 commented 2 years ago

Then I think that means it's not amplitude's issue itself. It might be some integration issue on your application.