How use this project from GitHub - android

How can use this Project
I add this line on my build.gradle file in dependencies section:
compile 'com.otaliastudios:zoomlayout:1.0.3'
But didn't compile the project. I have this information:
Enter image description here
How can I fix this?
Regards
Marcin

You have to add Google Maven repository to your project build.gradle. On Android Studio 2+:
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
On Android Studio 3+:
allprojects {
repositories {
jcenter()
google()
}
}

Related

Android gradle problem while build with using MPAndroidChart

I am trying to use MPAndroidChart, but there is occuring build gradle problem.
I reference the github document below.
https://github.com/PhilJay/MPAndroidChart
I follow the 'Gradle Setup'
repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'
}
This is how I put the codes
and when I started to build it the error code is
Build was configured to prefer settings repositories over project repositories but repository 'maven' was added by build file 'app\build.gradle'
Did I put the build code in the wrong way? or did I missed some important settings?
Probably, you need to append the entry, maven { ... } to the dependencyResolutionManagement.repositories clause in settings.gradle.
app/build.gradle
// repositories {
// maven { url 'https://jitpack.io' }
// }
settings.gradle
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
maven { url 'https://jitpack.io' }
}
}

Could not find com.android.tools.build:gradle:4.1.2

In Android Studio, I get this error when I create a project:
Could not find com.android.tools.build:gradle:4.1.2.
Correct your app top-level build.gradle file and include Maven repo to download plugin from:
buildscript {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://maven.google.com" }
mavenCentral()
}
}
Other option, it's possible to use beta version of Android Studio and upgrade to new version of AGP:
classpath 'com.android.tools.build:gradle:7.0.0-alpha07'

Android Studio 3.1 : Could not find org.jetbrains.trove4j:trove4j:20160824

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.

android studio appcompat v7:26

I have a problem with android studio.
I will create a new project (without changing the parameter, just the next one), then I encounter these problems.
Go to your Project level build.gradle and add this after that sync
allprojects {
repositories {
jcenter()
google()
}
}
From version 26.0.0 of support libraries make sure that the
repositories section includes a maven section with the
"https://maven.google.com" endpoint.
Read Document
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
For Gradle build tools plugin version 3.0.0, you can use google()
repository:
Read Document
allprojects {
repositories {
jcenter()
google()
}
}

Android gradle - how to search multiple respositories for gradle dependencies

So our group has a private maven repository with a large number of libraries 'in-house'. So there only available on a vpn. bintray and jcenter is available on my vpn. What i want to do is have gradle check for a dependency first on the private maven repo, if not found then search bintray/jcenter for the library. How can i do this ? this is what i have tried:
In the top level build.gradle file i have:
buildscript {
repositories {
maven { url "https://myprivateRepo.com/libraries"
}
jcenter()
}
my assumption was that it would first check maven private repo and then check with jcenter afterwards but it seems to not be working, can anyone verify the set up ?
You're adding the repositories for your buildscripts (or plugins). You need to add it to your project / dependencies level.
Using it with buildscript will resolve plugins. You need that e.g. if you are using apt: apply plugin: 'com.neenbedankt.android-apt'
Remove the wrapping buildscript block:
repositories {
maven { url "https://myprivateRepo.com/libraries" }
mavenCentral()
jcenter()
}
dependencies {
compile "my:library:1.0.0"
// ...
}
Alternatively just set it on the project root build.gradle and apply to all projects like this
allprojects {
repositories {
maven { url "https://myprivateRepo.com/libraries" }
mavenCentral()
jcenter()
}
}

Categories

Resources