sentry-android-gradle-plugin: Sentry version 3.0.0-beta.4 breaks react native project imports in Android Studio

Android Gradle Plugin: 7.0.4

Gradle: 7.3.3

Optimizer:

  • R8

Have you created the sentry.properties file?

  • Yes -> android folder of the react native project

SDKs:

  • sentry-react-native -> 3.2.13

I have the following issue:

I have an react native expo project setup and was trying to add the sentry gradle plugin (version 3.0.0-beta.4) to the rest of the project setup. Unfortunately I have noticed that this breaks the project integration with Android Studio. yarn react-native run-android still works fine, but looking at any classes in Android Studio (generated or other project files) none are able to properly import native modules provided by the react native autolinking. Additionally I have noticed that the kotlin plugin integration is broken again and is not functioning correctly anymore. Removing the sentry gradle plugin fixes the problems again.

Steps to reproduce:

  • Run create-react-native-app my-project and create a project using expo.
  • Update dependencies so that the mentioned versions for gradle are working fine, like using the latest RN version 0.67.2.
  • Add id "io.sentry.android.gradle" version "3.0.0-beta.4" to the plugins block of the android/app/build.gradle file.
  • Resync and rebuild the project
  • After that is done, you will notice a lot of broken imports in your project. For example in your PackageList.java file which is generated by react native or in your Application.java.

Actual result:

  • Imports provided via native modules from react-native autolinking are broken and do not resolve.

Expected result:

  • Project can be used in Android Studio without problems.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (15 by maintainers)

Most upvoted comments

Just an update - I think I experienced the problem myself, and also found a fix for that, will test it a bit more and then supply the fix

@romtsn Thanks for the update. My project is working fine for me, even with removing the tracingInstrumentation usage.

@AlexanderEggers hm, ok, I’d need to look into this then, for now please stick to disabling the tracingInstrumentation. Thanks for checking!

Hey, thanks for the report, 2 things:

  1. Additionally I have noticed that the kotlin plugin integration is broken again and is not functioning correctly anymore.

What do you mean by “again”? Is this a known problem that popped up in the past? Could you elaborate a bit more on the problem?

  1. Could you try to sentry.tracingInstrumentation.enabled = false and see if that resolves the problems?