Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failing with: Could not determine the dependencies of task ':newrelic-react-native-agent:compileDebugJavaWithJavac'. #218

Open
BlackH3art opened this issue Feb 19, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@BlackH3art
Copy link

BlackH3art commented Feb 19, 2025

Description

We are unable to build and launch our appliaction after newrelic-react-native-agent package instalation.

Following installation steps from here, skipped step 4. as it says "(Android-native apps only) Install the Android agent" and 5. as we are not intersted with iOS, application fails to build.

edit 1
Even trying all the stepswith android/settings.gradle and android/app/build.gradle modifiactions did not result in successfull build.

Steps to Reproduce

Not sure what is causing the problem.
I simply installed the package:

yarn add newrelic-react-native-agent

Added the configuration to my main layout.tsx file:

const agentConfiguration = {
  // example configuration from docs
};

const appToken = 'application_token_from_dashboard';

NewRelic.startAgent(appToken, agentConfiguration);
NewRelic.setJSAppVersion('1.0.999');

Next adding classpath('com.newrelic.agent.android:agent-gradle-plugin:7.6.2') to android/build.gradle

    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
        classpath('com.newrelic.agent.android:agent-gradle-plugin:7.6.2')
    }

Then adding apply plugin: 'newrelic' to android/app/build.gradle

Then added plugin to expo config:

    plugins: [
      'expo-router',
      'newrelic-react-native-agent',
    ]

Then I ran:

npx expo prebuild --clean

Also tried:
cd ./android
./gradlew clean

And then trying to run the application with:

expo run:android

Expected Behavior

Application should be connected with New Relic.

Relevant Logs / Console output

> Configure project :newrelic-react-native-agent
:newrelic-react-native-agent package.json found at C:\Projekty\3-tm-mobile\node_modules\newrelic-react-native-agent\package.json
:newrelic-react-native-agent:newrelic.android using default value: 7.6.2
:newrelic-react-native-agent:newrelic.ndk using default value: 1.1.1
:newrelic-react-native-agent package.json found at C:\Projekty\3-tm-mobile\node_modules\newrelic-react-native-agent\package.json
:newrelic-react-native-agent:version set from package.json: 1.4.8 (1,4,8 - 1004008)

> Configure project :react-native-reanimated
Android gradle plugin: 8.2.1
Gradle: 8.8

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':newrelic-react-native-agent:compileDebugJavaWithJavac'.
> Cannot query the value of this provider because it has no value available.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

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

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

For more on this, please refer to https://docs.gradle.org/8.8/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 3m 53s
10 actionable tasks: 8 executed, 2 from cache
Error: C:\project\path\android\gradlew.bat app:assembleDebug -x lint -x test --configure-on-demand --build-cache -PreactNativeDevServerPort=8081 -PreactNativeArchitectures=arm64-v8a,armeabi-v7a exited with non-zero code: 1

Your Environment

Platform: Android
Packages:

    "expo": "~51.0.39",
    "react-native": "0.74.5",
    "newrelic-react-native-agent": "^1.4.8",

npx react-native info:

System:
  OS: Windows 10 10.0.19045
  CPU: (4) x64 Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz
  Memory: 2.61 GB / 11.41 GB
Binaries:
  Node:
    version: 22.9.0
    path: C:\Program Files\nodejs\node.EXE
  Yarn:
    version: 1.22.22
    path: C:\Program Files\nodejs\yarn.CMD
  npm:
    version: 10.8.3
    path: C:\Program Files\nodejs\npm.CMD
  Watchman: Not Found
SDKs:
  Android SDK: Not Found
  Windows SDK: Not Found
IDEs:
  Android Studio: AI-241.19072.14.2412.12360217
  Visual Studio: Not Found
Languages:
  Java:
    version: 17.0.12
    path: C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.74.5
    wanted: 0.74.5
  react-native-windows: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
@BlackH3art BlackH3art added the bug Something isn't working label Feb 19, 2025
@ndesai-newrelic
Copy link
Contributor

@BlackH3art Could you please share your AGP (Android Gradle Plugin) and Gradle versions with us? We are currently unable to reproduce this issue on our end. If possible, could you also provide a sample app that demonstrates the issue? This would greatly assist us in diagnosing and resolving the problem.

@BlackH3art
Copy link
Author

@ndesai-newrelic Hi, and thank you for quick reply.
I belive that it is mentioned in logs above:

Android gradle plugin: 8.2.1
Gradle: 8.8

Otherwise I don't see any specific versions to be mentioned..

gradle-wrapper.properties:

distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-all.zip

android/build.gradle:

buildscript {
    ext {
      // ...
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath('com.android.tools.build:gradle')
        classpath('com.facebook.react:react-native-gradle-plugin')
        classpath('org.jetbrains.kotlin:kotlin-gradle-plugin')
    }
}

* NOTE: as of know newrelic-react-native-agent is removed from the project as it breaks the app

Sample repo:
Right now, I'm afraid I won't be able to prepare sample repo unfortunately, but perhaps we can jump on a call so I'll be able to show you whole installation process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants