talsec/Free-RASP-ReactNative

Execution failed for task ':freerasp-react-native:minifyReleaseWithR8'.

Closed this issue · 10 comments

Bug Description
on ./gradlew app:assembleRelease I am getting following error

Execution failed for task ':freerasp-react-native:minifyReleaseWithR8'.

A failure occurred while executing com.android.build.gradle.internal.tasks.R8Task$R8Runnable
Compilation failed to complete, origin: /../node_modules/freerasp-react-native/android/build/tmp/kotlin-classes/release/com/freeraspreactnative/Threat.class

RASP Version Info

  • Version of freeRASP: 3.7.0

React native version info

  • "react": "18.2.0",
  • "react-native": "0.73.6",

Hi @tusharsarkar,

I'll try to reproduce the bug and get back to you ASAP.

Thanks for reporting!

Tomas from Talsec

@tompsota any update on this issue

Hi, @tusharsarkar,

I've been busy preparing new release, but hopefully tomorrow I'll take a look at this issue.

Thanks for your patience and stay tuned!

Hi @tompsota ,
any update on this issue? Our release blocked due to this issue.

Hi @tusharsarkar,

I reproduced the problem. To resolve it, add following code on top of the settings.gradle or settings.gradle.kts file (inside android/ folder):

pluginManagement {
    buildscript {
        repositories {
            mavenCentral()
            maven {
                url = uri("https://storage.googleapis.com/r8-releases/raw")
            }
        }
        dependencies {
            classpath("com.android.tools:r8:8.2.24")
        }
    }
}

The issue is that RN 0.73.x uses AGP 8.1.x which does not support sealed classes. However, these are used in our project. The support is again added in AGP 8.2. By adding the code above, you specify that you want to use the use newer version of AGP.
Source: https://issuetracker.google.com/issues/227160052#comment37

Hopefully this resolves your problem.

Let us know if this helped.

Thanks @tompsota . This resolve the issue.

Great news!
I also added this into the troubleshooting section in readme.

Hey @tompsota, I'm using this package with Expo, as discussed previously, and requested support for Expo SDK.
While building an app, this issue still exists for me as being an ExpoSDK user.

Screenshot 2024-04-22 at 1 41 49 AM

To debug further, I'm providing a few more details to try:
"expo": "~50.0.15",
"react-native": "0.73.6",
"freerasp-react-native": "^3.7.1-1",
And as suggested, I do not have an Android directory at all.
How can I apply those settings in app.json or anywhere you recommend?

Hi @asharamseervi ,

I'll update the config plugin for Expo. Thanks for pointing it out.

Hello @asharamseervi,

just released v3.7.2, which fixes the issue for Expo.

you can use R8Version property in plugin config to increase the version of R8. Any version above 8.2 should work. 8.3.37 is the latest at the moment.

"plugins": [
      [
        "freerasp-react-native/app.plugin.js",
        {
          "android": {
            "R8Version": "8.3.37" 
          }
        }
      ]
    ],