Gradle - Failed to resolve - android

I know there are multiple threads on this already but not a single fix worked so I figured I must have a unique issue or be making a stupid error that someone smart can point out.
I am trying to use the Realm Recyclerview (found here : https://github.com/thorbenprimke/realm-recyclerview)
However I cannot get the gradle sync to go beyond error 29,13 Failed to resolve com.github.thorbenprimke:realmr-ecyclerview:0.9.12
My app build.gradle file looks like this :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.harris.school"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile files('libs/joda-time-2.9.jar')
compile 'com.android.support:cardview-v7:23.1.1'
compile 'io.realm:realm-android:0.84.1'
compile 'com.github.thorbenprimke:realm-recyclerview:0.9.12'
}
and the other one looks like this:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Thanks!

I faced the same issue and resolved by adding maven repository URL like this
android{
repositories{
maven{
url 'http://repo1.maven.org/maven2'
}
}
}
Hope this might helps you.

I had the same problem. Solved it by adding below code to build.gradle
allprojects {
repositories {
mavenCentral()
maven { url "https://jitpack.io" }
jcenter()
}
}

in the build.gradle file inside android {}, add this line
dexOptions {
javaMaxHeapSize "4g"
}
like
android {
dexOptions {
javaMaxHeapSize "4g"
}
}
if its still not building, you might have to enable multidex
Look at this Stack Overflow post for how to enable multidex
gradle - Android Studio build too slow multidex application

Related

Failed to resolve common open file gradle.build

I have been struggling with the past 6 hours over this one error, which i am not able to resolve.I imported the project directly from nextgis github.
Please identify whats wrong and how to rectify it.
here's the screen-shot of the error
here the build.gradle file from the module which contiains the error
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '27.0.3'
defaultConfig {
minSdkVersion 14
targetSdkVersion 26
versionCode 37
versionName '2.5.7.1'
buildConfigField "String", "CLIENT_ID", "\"Im6GFdPPuPM09BnvFb3EacFZyq8TpRBSAAex7JDZ\""
}
productFlavors {
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
repositories {
mavenCentral()
maven {url "https://maven.google.com"}
maven {
url "http://dl.bintray.com/krazykira/maven"
}
google()
jcenter()
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile project(':maplib')
compile 'com.4ert:easypicker:0.2.12'
compile 'com.github.yukuku:ambilwarna:2.0.1'
compile 'com.jzxiang.pickerview:TimePickerDialog:1.0.1'
compile 'com.github.miguelbcr:TableFixHeaders-Wrapper:0.2.0'
compile 'com.android.support:appcompat-v7:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:preference-v7:26.1.0'
compile 'com.appyvet:materialrangebar:1.4'
}
I was having the same issue after a git pull of a working project from one computer to another. What finally resolved it was making sure the project gradle file listed google() and had it before jcenter(). Final working form in ProjectDir/build.gradle looks like:
allprojects {
repositories {
google()
jcenter()
}
}
I am using Gradle 4.4 and the Android Studio Gradle plugin 3.1.3
Why it was working on one computer and not on the other one, I have no idea.
Solved when I wrote this code in Gradle:project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

Facing issue in Latest Support Library v26.0.0-beta1

I am facing weird issue in Latest support library.
I just migrated my project to the latest Support version provided by GOOGLE and as per google guideline
So the problem is can't find the cardView in latest support file. Is anyone facing this problem ?
here is my App Gradle file
apply plugin: 'com.android.application'
android {
compileSdkVersion 'android-O'
buildToolsVersion "26.0.0-rc2"
defaultConfig {
applicationId "com.temp"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
dataBinding {
enabled = true
}
lintOptions {
disable 'RestrictedApi'
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile "com.android.support:appcompat-v7:$support_libs"
compile "com.android.support:design:$support_libs"
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'jp.wasabeef:blurry:2.1.1'
}
// REQUIRED: Google's new Maven repo is required for the latest
// support library that is compatible with Android O
repositories {
maven {
url 'https://maven.google.com'
// Alternative URL is 'https://dl.google.com/dl/android/maven2/'
}
}
and here is the project gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.support_libs = '26.0.0-beta1'
repositories {
maven { url 'https://maven.google.com' }
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven { url 'https://maven.google.com' }
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I don't see cardview added to dependencies anywhere in your app gradle file. Try adding:
compile 'com.android.support:cardview-v7:25.3.1'
AppCompat v7 don't contain CardView, you need to make the explicit claim of that lib in your dependencies.
So, add compile 'com.android.support:cardview-v7:$support_libs' to your dependencies.
Add these dependencies in gradle file:
compile 'com.android.support:appcompat-v7:25.2.0'
compile 'com.android.support:design:25.2.0'
compile 'com.android.support:cardview-v7:25.2.0'

Cannot invoke method version() on null object

i'm trying to use the Jgrapht library but it needs lambdas...
Here's my code:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
jcenter()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
classpath 'com.android.tools.build:gradle:2.2.1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And the :app
apply plugin: "me.tatarka.retrolambda" version "3.3.0"
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "24.0.3"
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "it.univpm.gruppoids.iotforemergencyandnavigation"
minSdkVersion 16
targetSdkVersion 23
versionCode 1
versionName "1.0"
jackOptions {
enabled true
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.journeyapps:zxing-android-embedded:3.2.0#aar'
compile 'com.google.zxing:core:3.2.1'
compile 'org.jgrapht:jgrapht-core:1.0.0'
}
The error is: Error:(1, 0) Cannot invoke method version() on null object
Open File
Where and what is the error? thanks
You're mixing two kinds of syntaxes. Use either
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "gradle.plugin.me.tatarka:gradle-retrolambda:3.3.0"
}
}
apply plugin: 'me.tatarka.retrolambda'
or
plugins {
id "me.tatarka.retrolambda" version "3.3.0"
}
(gradle-retrolambda README), see also the gradle documentation.
I have the same issue.
You'll need to update a few things:
android/build.gradle:
i) classpath 'com.google.gms:google-services:4.0.1'
ii) Make sure google() appears above jcenter() in both buildscripts and allprojects
android/app/build.gradle:
Update Android libs to the latest specified here:
https://firebase.google.com/support/release-notes/android#20180523
if you have other libraries (for me, it's firebase) make sure to check build.gradle of the libraries, too.

Gradle/Android Studio doesn't pull dependencies from specified repositories

NOTE: This is a followup of my last question that still remained unsolved.
I'm using a fully updated AndroidStudio with the default gradle support.
Android Studio can self update (thus sees Internet for sure).
I have no reason to beleive that Gradle can't reach the internet nor any error that could imply that, and I verified that it's not on offline mode.
Here's my Here's my top-level build.gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
}
and here's my app/build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.github.jitpack:android-example:1.0.4'
}
Here I'm trying to pull the jitpack.io sample, and still getting:
Error:(31, 13) Failed to resolve: com.github.jitpack:android-example:1.0.4
without any additional information.
try this :
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
}
}
Then in your app/build.gradle :
apply plugin: 'com.android.application'
repositories {
maven { url "https://jitpack.io" }
flatDir {
dirs 'libs'
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0"
defaultConfig {
applicationId "com.domain.app"
minSdkVersion 19
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.0'
compile 'com.github.jitpack:android-example:1.0.4'
}
Its not the problem of android studio, To inform you
Neither
compile 'com.github.jitpack:android-example:1.0.4'
Nor
compile 'com.github.User:Repo:Tag'
Both doesn't compile now, Because it's no longer available in the The Central Repository. You don't have any ways rather than seeing the codes inside.

Android: build.gradle error ("Failed to resolve")

So I am trying to implement the infinite scroll in the tabs like this: ViewPager as a circular queue / wrapping. This is github: https://github.com/antonyt/InfiniteViewPager
I am trying to add the dependencies to my build.gradle but I get an error: "Failed to resolve: com.antonyt. infiniteviewpager:library:1.0.0. Do you know how I can solve this? I tried clean project and invalidate cache/restart.
This is my build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.1"
defaultConfig {
applicationId "com.example.mariogp18.tanga"
minSdkVersion 16
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile 'com.antonyt.infiniteviewpager:library:1.0.0'
}
This is my other build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
This is my code: https://www.dropbox.com/s/ipe4zz1u3r0lnqt/App.zip?dl=0
This library is not on jcenter - there is also an open ticket for this:
https://github.com/antonyt/InfiniteViewPager/issues/35
you can look here: https://jcenter.bintray.com/com/ - no antonyt there
you might want to use jitpack.io then

Categories

Resources