I'm just trying to set up the Google Maven dependencies that I downloaded from:
https://d.android.com/r/studio-offline/downloads
I followed the "README" instructions and then tried to verify everything was working by commenting out jcenter() and google() from my project's "build.gradle".
When I try to run my project, this is the error I get:
Error: Could not find com.android.tools.build:gradle:4.1.2.
Error: Could not find org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.30.
README
Related
I have added the following to the dependencies part of my app build.gradle
implementation 'org.seleniumhq.selenium:selenium-htmlunit-driver:3.56.0'
But I get the error:
Could not find org.seleniumhq.selenium:selenium-htmlunit-driver:3.56.0.
Searched in the following locations:
- https://dl.google.com/dl/android/maven2/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
- https://repo.maven.apache.org/maven2/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
- https://jcenter.bintray.com/org/seleniumhq/selenium/selenium-htmlunit-driver/3.56.0/selenium-htmlunit-driver-3.56.0.pom
Required by:
project :app
So in the project build.gradle file, I added to the repositories section:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
// ADDED THIS 2021 12 17
maven {
url("https://mvnrepository.com")
}
mavenCentral()
}
dependencies {
classpath "com.android.tools.build:gradle:7.0.3"
}
}
I thought this would work because there's a page with selenium-htmlunit_driver_3.56.0 when I navigate there, the domain mvnrepository.com, with my browser.
What I expected was that the specified dependency would be found. Or alternatively, I would get a report that would include another line under "Searched in the following locations:", but adding that maven line to the project build.grade has no effect.
What do I need to do in order for the additional maven repository to be searched? The maven repository that gets pulled-in from the mavenCentral() entry (repo.maven.apache.org/maven2...) does not contain the version of selenium-htmlunit-drive that I'd like to try.
This is using Artic Fox 2020.3.1 Patch 3.
What am I doing wrong?
Artic Fox started using another technique built on depedencyResolutionManagment which introduced this head-scratching situation where the entries in the application-level build.grade file are not searched.
What worked for me in this situation was to go into settings.gradle (not build.gradle and change:
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
to
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
and for good measure, I put my additional repository into settings.gradle resulting in the following:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS) // WAS: FAIL_ON_PROJECT_REPOS
repositories {
google()
mavenCentral()
jcenter() // Warning: this repository is going to shut down soon
maven {url 'https://mvnrepository.com'} // ADDED THIS
}
}
After making these changes, the appropriate artifacts were automatically downloaded by the Android Studio standard build process.
Try it with this URL: https://repo1.maven.org/maven2
The File is available here: Link
mvnrepository.com is only the frontend to search for dependencies, but not the file system with the jar-files themselves.
I want to use this library in my project: https://github.com/haldertaer/android-maps-utils
When I use implementation 'com.github.haldertaer:android-maps-utils:0.5' in Gradle, I get the following error: ERROR: Failed to resolve: com.github.haldertaer:android-maps-utils:0.5
And, yes, I already have this:
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
How can I fix this error? I do not see what's wrong.
As per the project documentation, the correct way to define the dependency for the official library is
implementation 'com.google.maps.android:android-maps-utils:0.5'
Update
As per your comment, you want to resolve the forked version rather than the official one using JitPack. When using JitPack, version must be one of "Release tag, commit hash or -SNAPSHOT" (Building with JitPack). You can try with
com.github.haldertaer:android-maps-utils:master-SNAPSHOT
or
com.github.haldertaer:android-maps-utils:72b39c8
I have just started using Android Studio,
So forgive me if i am unable to explain the situation properly.
But i will try to update details as required.
In my gradle project i use JakeWarton DiskCache with nineoldandroids
Both as jar files added to the app/libs folder.
In addition there also a Library project from this location
https://android-arsenal.com/details/1/122
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile 'com.github.flavienlaurent:datetimepicker:0f5d399995'
}
I use it by adding the repository and dependency as shown above.
When i try to run this project i get following error
Execution failed for task ':app:packageAllDebugClassesForMultiDex'.
java.util.zip.ZipException: duplicate entry: com/nineoldandroids/animation/Animator$AnimatorListener.class
I can understand that since my app has a copy of nineoldandroids.jar and the lib-project also needs it at compile time there is some kind of issue.
How can i fix this conflict?
The library com.github.flavienlaurent:datetimepicker:0f5d399995 is using the
nineoldandroids library as a maven dependency.
dependencies {
compile 'com.nineoldandroids:library:2.4.0'
//...
}
Check the original build.gradle file in github.
To solve your issue you have to:
remove the nineoldandroids.jar from your project
add the nineoldandroids library as maven dependency in your project
Use:
dependencies{
//
compile 'com.nineoldandroids:library:2.4.0'
}
I get the android example android-NetworkConnect, and I can build it within Android-Studio-1.3.
Then I want to build it with gradle command line, however I got a failed result.
/// get the example code
https://github.com/googlesamples/android-NetworkConnect
/// setting gradle
export GRADLE_HOME=/opt/gradle/gradle-2.2.1
export PATH=${PATH}:$GRADLE_HOME/bin
/// building failed
android-NetworkConnect-master $ gradle build
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring project ':Application'.
> Could not resolve all dependencies for configuration ':Application:classpath'.
> Could not resolve com.android.tools.build:gradle:1.2.3.
Required by:
android-NetworkConnect-master:Application:unspecified
> Could not GET 'https://jcenter.bintray.com/com/android/tools/build/gradle/1.2.3/gradle-1.2.3.pom'.
> jcenter.bintray.com
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
BUILD FAILED
Total time: 3.771 secs
/// build.gradle
android-NetworkConnect-master $ cat build.gradle
allprojects {
repositories {
jcenter()
}
}
Gradle is failing to get a dependency that you need ('com.android.tools.build:gradle:1.2.3') from the JCenter repo.
That dependency is available, so it's possible that for some reason the machine you're building on cannot get to the JCenter repo - does it have access to the internet? Often machines like production or QA environments do not have external access.
Alternatively you could try to connect to the Maven central repo to see if you can download from there, by updating your build file to add the Maven central repository:
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
To find out more information about the failure, you can follow the advice of the error message: instead of running
gradle build
try running
gradle build --stacktrace
to see a more detailed error. This might tell you whether it's a network connection problem or not.
It is caused by https_proxy setting.
After I set the https_proxy in ~/.gradle/gradle.properties, it worked.
Here is another example for gradle.properties:
http://qiita.com/ajaxsys#github/items/fa06b4312383042beecc
I read this page, that learn "importing libraries into android studio". but it's doesn't work for me. i do those step for Material Design Library. in Material Design's build.gradle file have:
https://github.com/navasmdc/MaterialDesignLibrary/blob/master/MaterialDesign/build.gradle
when i click on "Sync Project with Gradle Files" it's gives me two error:
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
Error:(3, 0) Plugin with id 'com.jfrog.bintray' not found.
Can any one tell me how to solve those error's?
note: i read this, but don't understand.
If you want to download the Material Design Library and import it without using the gradle method pyus13 mentioned, you need to add the following lines to the MaterialDesign Build.gradle file:
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.dcendents:android-maven-plugin:1.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.0'
}
}
To find this file, you can double click on the error you get when syncing that looks like this:
Error:(2, 0) Plugin with id 'com.github.dcendents.android-maven' not found.
I also had to add compile project(':MaterialDesign') to the app build.gradle file.
Dont follow the above tutorial, the shown approach is useful when the library has not published as maven or gradle dependency.But as Github page say it is published on maven.
So remove the module or library project completely from your project and use gradle dependency instead.
Just copy this in your app module's build.gradle inside dependencies closure
dependencies {
// YOUR OTHER DEPENDENCIES
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
}
Sync your project with gradle.
This was kindly answered #pyus13 but I would like to give the complete answer, with the source, github.com/navasmdc/MaterialDesignLibrary#howtouse:
You can use the gradle dependency, you have to add these lines in your
build.gradle file:
repositories {
jcenter()
}
dependencies {
compile 'com.github.navasmdc:MaterialDesign:1.+#aar'
}
The build.gradle you are looking for is in ProjectName\app\src.
Add two dependencies in your Project build.gradle
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
}