3

I'm trying to add Appdynamics into my application, I'm doing those steps: https://docs.appdynamics.com/display/PRO40/Instrument+an+Android+Application#InstrumentanAndroidApplication-ToaddtheAppDynamicsAndroidagentrepositorytoyourproject but after all I have error:

Error:(15, 13) Failed to resolve: com.appdynamics:appdynamics-runtime:1.0

This is how my build.gradle (for all project) looks like:

buildscript {
  configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
  repositories {
      maven { url uri("adeum-maven-repo") }
      mavenCentral()
  }
  dependencies {
      classpath 'com.android.tools.build:gradle:1.2.3', 'com.appdynamics:appdynamics-gradle-plugin:2.0'
  }
}

  allprojects {
    repositories {
        mavenCentral()
  }
}

and build.gradle (from app module):

apply plugin: 'adeum'

repositories {
  flatDir {
      dirs 'lib'
  }
  maven {
      url uri('adeum-maven-repo')
  }
}
dependencies {
compile 'com.appdynamics:appdynamics-runtime:1.0'

and adeum-maven-repo paste into project. Any idea what am I doing wrong?

falsetto
  • 789
  • 2
  • 11
  • 35

1 Answers1

7

That error means that gradle is unable to resolve the dependency on com.appdynamics:appdynamics-runtime. The easiest way to fix this problem is to use the AppDynamics libraries from maven central rather than the adeum-maven-repo directory. You can do that by editing your top level gradle file to look like this:

buildscript {
    configurations.classpath.resolutionStrategy.force('com.android.tools.build:gradle:1.2.3')
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:1.2.3'
        classpath 'com.appdynamics:appdynamics-gradle-plugin:4.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

Then your project-level gradle file would look like:

apply plugin: 'adeum'

repositories {
    flatDir {
        dirs 'lib'
    }
}

dependencies {
    compile 'com.appdynamics:appdynamics-runtime:4.+'
}

Note that I have removed the references to adeum-maven-repo, and changed the version numbers on the AppDynamics artifacts to refer to them as they exist in maven central. Once you've done this, you no longer need adeum-maven-repo in your project, since gradle is now downloading these dependencies automatically.

  • Everything is rather fine but after run application I have `NoClassDefFoundError` connected with another added to gradle file: `E/dalvikvm﹕ Could not find class 'com.nostra13.universalimageloader.core.DisplayImageOptions$Builder', referenced from method initImageLoader ` and `java.lang.NoClassDefFoundError: org.jacoco.agent.rt.internal_38bf6f6.Offline` – falsetto Jun 30 '15 at 12:29
  • And I think that this problem is with each imported dependencies and those 2 errors are because of running in Application class. – falsetto Jun 30 '15 at 13:18