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

Hi!
I’m trying to create an app using react-native but I have some issue.

For now I’m testing only on android but the main problem for now is that the app works on simulator and on real device in debug mode. If I create the apk (gradlew assembleRelease) the app crashes on startup on my device.

During the build of the release I have several warnings like that one:

Gradle detected a problem with the following location: ‘C:\Users\xxx\Desktop\Projects\openvidu-tutorials\openvidu-react-native’. Reason: Task ‘:app:bundleReleaseJsAndAssets’ uses this output of task ‘:react-native-incall-manager:writeReleaseAarMetadata’ without declaring an explicit or implicit dependency. This can lead to incorrect results being produced, depending on what order the tasks are executed. Please refer to Dealing with validation problems for more details about this problem.

but I think the most important problem is that one:

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

I also tried to create a completely new react-native project but when I place inside the code from the example (converted in typescript) I have other issue about some libraries. For example I have the error inside react-native-webrtc/src/getUserMedia.ts and the error is:

Possible unhandled promise rejection (id:0): TypeError: Cannot read property ‘getUserMedia’ of null

Could you help me to solve in some way, with your version of with a complete new project?

I add some more info here.

  • package.json info:
{
  "name": "openvidu-react-native",
  "version": "2.29.0",
  "private": true,
  "scripts": {
    "start": "react-native start",
    "start:cache": "npm start -- --reset-cache",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "build:android": "mkdir -p android/app/src/main/assets/ && npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle && cd android && ./gradlew assembleRelease",
    "copy:android": "cp ./android/app/build/outputs/apk/release/app-release.apk /opt/openvidu/android/openvidu-react-native.apk",
    "clean": "rm -rf $TMPDIR/react-native-packager-cache-* && rm -rf $TMPDIR/metro-bundler-cache-* && rm -rf node_modules && rm -f package-lock.json",
    "install-ov": "npm i openvidu-react-native-adapter-2.29.0.tgz",
    "test": "jest"
  },
  "dependencies": {
    "axios": "0.27.2",
    "events": "3.3.0",
    "openvidu-browser": "2.29.0",
    "openvidu-react-native-adapter": "file:openvidu-react-native-adapter-2.29.0.tgz",
    "react": "18.1.0",
    "react-native": "0.70.6",
    "react-native-get-random-values": "1.8.0",
    "react-native-incall-manager": "4.0.1"
  },
  "devDependencies": {
    "@babel/core": "7.20.7",
    "@babel/runtime": "7.20.7",
    "@react-native-community/eslint-config": "3.2.0",
    "babel-jest": "29.3.1",
    "jest": "29.3.1",
    "metro-react-native-babel-preset": "0.73.6",
    "react-test-renderer": "18.1.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

  • I followed the instruction on this link and all worked in debug mode on simulator and real Android device
  • I create the keystore with this command:

keytool -genkeypair -v -storetype jks -keystore my-upload-key.keystore -alias my-key-alias -keyalg RSA -keysize 2048 -validity 10000

  • I moved the “.keystore” file inside android/app folder
  • Inside android/gradle.properties I added these lines:
MYAPP_UPLOAD_STORE_FILE=my-upload-key.keystore
MYAPP_UPLOAD_KEY_ALIAS=my-key-alias
MYAPP_UPLOAD_STORE_PASSWORD=*****
MYAPP_UPLOAD_KEY_PASSWORD=*****
  • Modified android/app/build.gradle adding this:
 release {
            if (project.hasProperty('MYAPP_UPLOAD_STORE_FILE')) {
                storeFile file(MYAPP_UPLOAD_STORE_FILE)
                storePassword MYAPP_UPLOAD_STORE_PASSWORD
                keyAlias MYAPP_UPLOAD_KEY_ALIAS
                keyPassword MYAPP_UPLOAD_KEY_PASSWORD
            }
        }

and setting this:

signingConfig signingConfigs.release
  • I go inside android folder andlaunch the command: gradlew assembleRelease

And then I receive the errors wrote above and if I move the apk on my Android device the app crashes on startup.

Hi @Mauro ,

Have you experimented the same problem using Android Studio for building and creating the release APK file?

I just tried and I received the same issue with this message:

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

I tried to update the Gradle version using Android Studio interface but when I run the update I received this error:

Calling `[node, C:\Users\xxx\Desktop\Projects\francesi\openvidu-tutorials\openvidu-react-native\node_modules\@react-native-community\cli\build\bin.js, config]` finished with an exception. Error message: groovy.json.JsonException: Unable to determine the current character, it is not a string, number, array, or object

The current character read is 'i' with an int value of 105
Unable to determine the current character, it is not a string, number, array, or object
line number 1
index number 0
info Run CLI with --verbose flag for more details.
^. Output: info Run CLI with --verbose flag for more details.

Could you test on your side?

Hi Mauro,
I can confirm that running that command in my project, the apk is generated correctly on my side…

I’ve added harcoded release properties into the build.gradle file

        debug {
            storeFile file('debug.keystore')
            storePassword 'android'
            keyAlias 'androiddebugkey'
            keyPassword 'android'
        }
        release {
            storeFile file('../../../../../Desktop/test.jks')
            storePassword '123456789'
            keyAlias 'key0'
            keyPassword '123456789'
        }
    }

After command is finished I’ve installed the signed apk in my Android device and launch the official sample without problems.

The only thing I did is update the openvidu-react-native-adapter dependencies with the aim of get update the webrtc stack (react-native-webrtc) and openvidu-browser to 2.29.1 (the adapter includes them so the main application does not need install by itself).

Thanks Carlos,
I will try again and also will try on another pc and see what happens. I will let you know.

I tried again from another pc. I can do the build but the app still crash when I install the apk on my device.

Could you do a test with my apk here:

Which version of JDK and Gradle are you using?

Finally I solved the issue checking the Android log.
It seems the problem was that the file “android/app/src/main/assets/index.android.bundle” was not present.
Now I do some more test, but now I can create the release of the demo.

That’s great Mauro. I’ll mark this issue as resolved then

1 Like