Application crashes in onCreate due to newrelic exception
Asked Answered
G

3

6

I've created an Android app using Android Studio beta 0.8.2 and all was going well until the last few days when i started getting this exception just as i run it:

    07-24 14:50:11.044    1176-1176/com.vme.vme I/Crashlytics﹕ Initializing Crashlytics 1.1.11.10
07-24 14:50:11.764    2325-2325/system_process D/MobileDataStateTracker﹕ default: Broadcast received: android.intent.action.ANY_DATA_STATE apnType=default
07-24 14:50:11.769    2325-2325/system_process D/MobileDataStateTracker﹕ default: Received state=CONNECTED, old=CONNECTED, reason=(unspecified)
07-24 14:50:15.079    1176-1176/com.vme.vme W/Crashlytics﹕ Crashlytics initialization was not completed in the allotted time.
07-24 14:50:15.104    1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.instrumentation.Instrumentation.openConnection, referenced from method com.vme.vme.model.network.httpClient.BasicRequestHandler.openConnection
07-24 14:50:15.104    1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30466: Lcom/newrelic/agent/android/instrumentation/Instrumentation;.openConnection (Ljava/net/URLConnection;)Ljava/net/URLConnection;
07-24 14:50:15.104    1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0009
07-24 14:50:15.114    1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart
07-24 14:50:15.114    1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114    1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0000
07-24 14:50:15.114    1176-1176/com.vme.vme I/dalvikvm﹕ Could not find method com.newrelic.agent.android.background.ApplicationStateMonitor.getInstance, referenced from method com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStop
07-24 14:50:15.114    1176-1176/com.vme.vme W/dalvikvm﹕ VFY: unable to resolve static method 30464: Lcom/newrelic/agent/android/background/ApplicationStateMonitor;.getInstance ()Lcom/newrelic/agent/android/background/ApplicationStateMonitor;
07-24 14:50:15.114    1176-1176/com.vme.vme D/dalvikvm﹕ VFY: replacing opcode 0x71 at 0x0003
07-24 14:50:15.309    1176-1176/com.vme.vme D/AndroidRuntime﹕ Shutting down VM
07-24 14:50:15.309    1176-1176/com.vme.vme W/dalvikvm﹕ threadid=1: thread exiting with uncaught exception (group=0x41797c80)
07-24 14:50:15.429    1176-1176/com.vme.vme E/AndroidRuntime﹕ FATAL EXCEPTION: main
    Process: com.vme.vme, PID: 1176
    java.lang.NoClassDefFoundError: com.newrelic.agent.android.background.ApplicationStateMonitor
            at com.vme.vme.ui.activities_and_fragments.home.bases.VMEBaseActivity.onStart(VMEBaseActivity.java)

I never used newrelic in this project, i've searched "newrelic" and can't find it in the whole project.

Things i can share also:

  • I have 2 instance of the studio running all the time, in the other project **i am using newrelic - version 2.426.0 **
  • it's happened on Galaxy S3 and Note 2.
  • Cleaning, rebuilding, closing the studio, uninstalling and reinstalling are fixing the issue. BUT IT COME BACK EVERY ONCE A DAY :(

Please help...

Gatekeeper answered 24/7, 2014 at 12:9 Comment(0)
G
1

The thing that fixed for me was upgrading to the newest gradle version 2.1 and android plugin version to 0.13.3 from right click project folder -> module settings

enter image description here

Glenglencoe answered 10/10, 2014 at 19:29 Comment(1)
Yeah i've also upgraded it, no more "gradle --stop" :) Thanks.Gatekeeper
C
3
  1. Build your New Relic enabled project
  2. Run gradle --stop from the terminal/command line
  3. Open your non-NR enabled app and clean & rebuild
  4. Run the app

If you still get messages about New Relic in your non-NR app, you can go to the ~/.gradle/caches and remove it. Then try the above steps again.

Newer versions of gradle utilize a daemon which caches New Relic instrumentation. So this will stop the daemon and allow the app to build.

You will also want to upgrade to the latest version of New Relic. 2.426.0 is many versions behind. Go here: http://docs.newrelic.com/docs/releases/android

Cathay answered 24/7, 2014 at 16:23 Comment(2)
Thanks man, that fixed it :) its a shame i'll have to do it every time moving between the projects. I should upgrade NR indeed, maybe they solved the issue.Gatekeeper
BTW, i had to install gradle on my mac using this tutorial: geektime.co.il/geektime-conference-a-month-away. So i could call gradle on the terminal.Gatekeeper
G
1

The thing that fixed for me was upgrading to the newest gradle version 2.1 and android plugin version to 0.13.3 from right click project folder -> module settings

enter image description here

Glenglencoe answered 10/10, 2014 at 19:29 Comment(1)
Yeah i've also upgraded it, no more "gradle --stop" :) Thanks.Gatekeeper
R
0

If you still get messages about New Relic in your non-NR app, you can go to the project directory and remove .gradle directory and re-build project.

Reverberate answered 25/7, 2014 at 14:44 Comment(3)
This didn't work. Also, .gradle dir haven't restored after re-build.Gatekeeper
I checked again. My project had 2 folders .gradle one at projects level other at root (up level, at same level where is settings.gradle ). I removed both directories. And after rebuild from console 'gradlew clean build --refresh-dependencies' only one was restored at root level.Reverberate
I removed both .gradle/ and gradle/ folders.. and finally it worked.Tyrosine

© 2022 - 2024 — McMap. All rights reserved.