Skip to content

applicationOnCreateTime equals -(device uptime in seconds) #559

Description

@MarekMacko

Description

NewRelicAppStartUpMetrics.applicationOnCreateTime is always a large negative number equal to -(SystemClock.uptimeMillis() / 1000) at the time of Application.onCreate(). The value is completely uncorrelated with the actual duration of Application.onCreate().

Steps to Reproduce

  1. Use NewRelic Android agent 7.7.6 with AGP 9.1.1 (or 9.0.1).
  2. Build and install the app on a device.
  3. Cold-launch the app and observe the App launch time NewRelicAppStartUpMetrics{...} log line.
  4. Note the device uptime via SystemClock.uptimeMillis() at Application.onCreate() start.

Repeatable formula:

applicationOnCreateTime ≈ -(SystemClock.uptimeMillis_at_onCreate_start / 1000)

Expected Behavior

applicationOnCreateTime should be a small positive number representing the actual duration of Application.onCreate().

In our case, measured independently via ActivityLifecycleCallbacks:

Application.onCreate START | uptime=3254618ms
Application.onCreate END   | uptime=3254637ms | duration=19ms

Expected: applicationOnCreateTime ≈ 0.019s
Actual: applicationOnCreateTime = -3254.35s

Relevant Logs / Console output

After fresh device reboot (~136s uptime):

D AppLaunchLifecycle: Application.onCreate START | uptime=136269ms
D AppLaunchLifecycle: Application.onCreate END   | uptime=136309ms | duration=40ms
D newrelic: NewRelicAppStartUpMetrics{
    contentProviderToAppStart=0.0,
    applicationOnCreateTime=-135.628,      <- should be ~0.040
    appOnCreateEndToFirstActivityCreate=136.387,
    firstActivityCreateToResume=1.679,
    coldStartTime=2.305,
    hotStartTime=90775.6,
    warmStartTime=2.305
}

After ~57 minutes uptime:

D AppLaunchLifecycle: Application.onCreate START | uptime=3454454ms
D AppLaunchLifecycle: Application.onCreate END   | uptime=3454471ms | duration=17ms
D newrelic: NewRelicAppStartUpMetrics{
    contentProviderToAppStart=0.0,
    applicationOnCreateTime=-3454.174,     <- should be ~0.017
    appOnCreateEndToFirstActivityCreate=3454.531,
    firstActivityCreateToResume=1.148,
    coldStartTime=1.505,
    hotStartTime=3455.679,
    warmStartTime=1.505
}

Your Environment

  • NewRelic Android agent version: 7.7.6
  • Android Gradle Plugin (AGP): 9.1.1 (also reproduced on 9.0.1)
  • Gradle version: 9.5.1
  • Kotlin: 2.3.21
  • compileSdk / targetSdk: 36
  • minSdk: 28
  • Test device: Samsung Galaxy Z Fold 4 (SM-F936B), Android 16

Additional context

  • contentProviderToAppStart is always 0.0 - is this correct?
  • Rebooting the device changes the magnitude of the negative value (confirming it tracks device uptime) but does not fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions