Skip to main content
Question

In React Native Android app has issue with gradle 8.2.1

  • 16 May 2024
  • 3 replies
  • 263 views

Hi 

I am using amplitude react native latest sdk @amplitude/analytics-react-native in react native. It is working fine with iOS, but when i try to build with Android, it is return error like as below:

A problem occurred configuring project ':amplitude_analytics-react-native'.
> defaultConfig contains custom BuildConfig fields, but the feature is disabled.
  To enable the feature, add the following to your module-level build.gradle:
  `android.buildFeatures.buildConfig true`

 


Can you guys suggest how we can resolve that issue?

Here, I tried to add this buildConfig flag but the issue is still there.

Thanks

 

3 replies

We have the same issue, have to hack into the library and add 

android {
...
buildFeatures {
buildConfig true
}
...
}

in node_modules/@amplitude/analytics-react-native/android/build.gradle

the error was gone, but got new issue reported

 

* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
 

Still struggling, really can use someone’s help here.

 

Thanks

The gradle version we are using is 8.5, React Native is 0.74.3

We have the same issue, have to hack into the library and add 

android {
...
buildFeatures {
buildConfig true
}
...
}

in node_modules/@amplitude/analytics-react-native/android/build.gradle

the error was gone, but got new issue reported

 

* What went wrong:
A problem occurred configuring project ':app'.
> compileSdkVersion is not specified. Please add it to build.gradle
 

Still struggling, really can use someone’s help here.

 

Thanks

have you been able to solve this issue? im stuck with the same error 

Reply