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?
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.
Related
My project is an old android application (module-front) with modules (module-shared) that used to be published on maven.
I have an access to source code of the module and I want to store my module in my mavenLocal.
My directory structure :
/project
/module-front
build.gradle
/module-shared
build.gradle
build.gradle
My module-front gradle file has a dependency on the published (but removed) module-shared :
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
android {
// Android properties here
}
dependencies {
ext {/* Versions here */}
compile group: 'module-shared group', name: 'module-shared name', version: moduleSharedVersion
// compile and testCompile here
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
apt {
// apt here
}
ModuleSharedVersion is defined in my root gradle file :
buildscript {
repositories {
mavenLocal()
jcenter()
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
}
}
allprojects {
ext {
moduleSharedVersion= '2.1'
}
version = '1.4.8h'
group = 'myGroup'
}
Problem starts here:
Now I want my module-shared to be stored in mavenLocal so my module-front might access it :
apply plugin: 'application'
apply plugin: 'maven'
version = '2.1'
uploadArchives {
repositories {
mavenInstaller {
repository(url: mavenLocal().url)
pom.groupId = 'module-shared group'
pom.artifactId = 'module-shared name'
pom.version = version
}
}
}
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
This is my attempt to store it in mavenLocal inspired from multiple posts (example) which doesn't work...
I don't know much about gradle, not enough to fix it tbh.
Please tell me if you need any other file that might be important to understand/answer.
Thanks :)
I am new to Android development. I have created a new project with Android Studio and need to import jetbrains exposed library into my existing project. When I tried to follow the exposed Getting Started guide to add the following into the build.grade file:
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
compile 'org.jetbrains.exposed:exposed:0.10.2'
}
I get the following error:
Could not find method compile() for arguments [org.jetbrains.exposed:exposed:0.10.2] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
I have been searching the internet for a couple of days now but still could not find out what's the problem.
This is the build.gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.2.40'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
compile 'org.jetbrains.exposed:exposed:0.10.2'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Hopefully someone could help me.
Thanking in advance.
You should put this dependency in the module level build.gradle file - by default, this is in the app folder, as opposed to the project level build.gradle file, which is in the root of your project.
Also, you should use implementation instead of compile, since you're using a newer than 3.0 version of the Android Gradle plugin:
repositories {
maven {
url "https://dl.bintray.com/kotlin/exposed"
}
}
dependencies {
implementation 'org.jetbrains.exposed:exposed:0.10.2'
}
Yesterday, I updated Android Studio to 3.1 and I'm getting this error :
Could not find org.jetbrains.trove4j:trove4j:20160824.
Searched in the following locations:
https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
https://repo.maven.apache.org/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.pom
https://dl.google.com/dl/android/maven2/org/jetbrains/trove4j/trove4j/20160824/trove4j-20160824.jar
Required by:
project :library > com.android.tools.build:gradle:3.0.1 > com.android.tools.build:gradle-core:3.0.1 > com.android.tools.lint:lint:26.0.1 > com.android.tools.lint:lint-checks:26.0.1 > com.android.tools.lint:lint-api:26.0.1 > com.android.tools.external.com-intellij:intellij-core:26.0.1
This is my project's gradle file :
buildscript {
repositories {
jcenter()
maven {
url 'https://maven.google.com/'
name 'Google'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// classpath 'com.google.gms:google-services:1.5.0-beta2'
classpath 'com.google.gms:google-services:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
maven {
url 'https://maven.google.com/'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my gradle-wrapper-properties's distdistributionUrl:
distdistributionUrl=https://services.gradle.org/distributions/gradle-4.4-all.zip
Try to replace all occurences of mavenCentral() with jcenter() in your gradle builds
Because jCenter will close in May, you should replace it with Maven. Thanks to giorgos.nl now we can add Trove4j:20160824. Thanks to Xavier Rubio Jansana we can replace maven { url 'https://plugins.gradle.org/m2/' } with gradlePluginPortal().
In root build.gradle write:
buildscript {
repositories {
google()
gradlePluginPortal()
}
}
allprojects {
repositories {
google()
mavenCentral()
// org.jetbrains.trove4j:trove4j:20160824.
gradlePluginPortal()
}
}
To add libraries that have not still been moved to mavenCentral, use this method.
Root build.gradle:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then you should search GitHub repositories of not resolved libraries. App's build.gradle example with two libraries:
dependencies {
// When a library has tags.
implementation 'com.github.RedMadRobot:input-mask-android:6.0.0'
// When a library doesn't have tags.
implementation 'com.github.savvisingh:DateRangePicker:master'
}
Now we can launch an application and build apk without errors.
I had the same mistake ... and for me the following worked:
Add jcenter() to repositories {} of allprojects
And add compile 'org.jetbrains.trove4j: trove4j: 20160824' in the build.gradle app module
I had this same error. I also had jcentre() at the appropriate place. But still it was not working.
One thing you can do which worked for me is clear the caches:
1. Close Android Studio.
2. Clear caches in here:
C:\Users"username"\.android\caches
C:\Users"username"\.gradle\caches
3. Open Android Studio.
Also make sure you have the version of the gradle which is newer than the minimum required.
I've deployed artifact to bintray as it whitten in documentation (using their plugin). All looks fine. It is opened in browder, structure looks fine: https://dl.bintray.com/flymob/maven/
Now I want to use it via gradle in Android Studio before publishing to jcenter(). I've read their documentation https://bintray.com/docs/usermanual/formats/formats_mavenrepositories.html#_working_with_gradle
I've tried:
buildscript {
repositories {
jcenter()
maven {
url "https://dl.bintray.com/flymob/maven"
}
}
}
and
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0'
or
compile 'flymob-sdk-sample:FlyMobSdk:1.3.0#aar'
I'm getting error:
Failed to resolve: flymob-sdk-sample:FlyMobSdk:1.3.0
What am I doing wrong?
you added "https://dl.bintray.com/flymob/maven" inside the buildscript section. Those are the repos used by the buildscript (a.k.a. gradle script) only. Those are the repos where the system will find the plugins from apply plugin
to fix it is easy. Just move it to the repositories on the "root" of the script. Something like:
buildscript {
repositories {
// repos for the build script
jcenter()
... etc
}
dependencies {
// dependencies from the plugins from the build script
classpath 'com.android.tools.build:gradle:2.1.2'
... etc
}
}
apply plugin: 'android-sdk-manager'
apply plugin: ... etc
repositories {
jcenter()
maven { url "https://dl.bintray.com/flymob/maven" } <<<<< HERE
}
dependencies {
compile ... etc
I have been trying to integrate mp4parser library
by adding
compile 'com.googlecode.mp4parser:isoparser:1.0.5.4'
But it gives me error
Error:(24, 13) Failed to resolve: com.googlecode.mp4parser:isoparser:1.0.5.4
Without your build.gradle I'm speculating here, but I think that you are missing:
repositories {
mavencentral()
}
in you main build.gradle file.
In my I have the following
allprojects {
buildscript {
repositories {
mavenCentral()
maven {
url "http://repository-monochromeroad.forge.cloudbees.com/release/"
}
}
}
repositories {
mavenCentral()
}
}
The second repositories {} block is essential.