Failed to resolve common open file gradle.build - android

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
}

Related

Not able to use kotlin library

I am trying to use this library for my app but as it is made in kotlin I am facing the problem . I downloaded the module of this library and imported this module in the project but in the initial state i am gettin kotlin plugin not found so i changed the gradel as this
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 26
buildToolsVersion "26.0.2"
defaultConfig {
minSdkVersion 17
targetSdkVersion 26
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
}
resourcePrefix "yal_ms_"
}
buidscript {
ext.kotlin_version = '1.0.1-2'
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.0.1-2'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile "com.android.support:appcompat-v7:26.1.0"
compile "com.android.support:recyclerview-v7:26.1.0"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}
repositories {
mavenCentral()
jcenter()
}
I am trying to use the kotlin library for the first time and I dont know any thing much about kotlin any advice how to use this library will be helpful .
Try Importing this library by gradle
Add maven { url "https://jitpack.io" } to the repositories of project gradle. So it will be like this
build.gradle(Project)
buildscript {
ext.kotlin_version = '1.1.60'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0'
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()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and add compile 'com.github.yalantis:multi-selection:v0.1' to dependencies in build.gradle(app)
This may create Manifest Merge Conflicts error while building project to remove that add tools:replace="android:label" under <application> tag in Manifest

Getting an error when using com.google.android.gms:play-services-maps:11.2.0 in my application

I am trying to create a simple Android application. I have the latest version of Android Studio and i think both my gradle build files are correct.
I have placed
implementation 'com.google.android.gms:play-services-maps:11.2.0'
in app gradle dependencies.
Due to this I get the following error:
Unable to resolve dependency for ':app#debug/compileClasspath': Could not resolve com.google.android.gms:play-services-maps:11.2.0.
I have looked at various links and tried out proposed solutions but none have worked for me.
Below are both my gradle build files.
project build.gradle:
//Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath 'com.google.gms:google-services:3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://repo.situm.es/artifactory/libs-release-local" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
defaultConfig {
applicationId "demo.situm.situmapp"
minSdkVersion 21
targetSdkVersion 26
versionCode 1
versionName "1.0"
//testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
matchingFallbacks = ['release', 'debug']
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android.gms:play-services-maps:11.2.0'
//testImplementation 'junit:junit:4.12'
//androidTestImplementation 'com.android.support.test:runner:1.0.1'
//androidTestImplementation 'com.android.support.test.espresso:espresso-
core:3.0.1'
}
//apply plugin: 'com.google.gms.google-services'
Hope you can help.
Thanks,
Kabir
try this i found:
Failed to resolve com.google.android.gms play-services-auth:11.2.0
Add maven to your root level build.gradle file
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
This maven repo is required starting from 11.2.0.
Or add google() repository to your "build.gradle" file. This gradle method is equivalent to
maven { url "https://maven.google.com" }.
repositories {
jcenter()
google()
}

Problems when create a project in Android Studio

I made a new project in android studio, when this finally was created in the main activity marked some errors, one of those errors is the AppCpmátActivity, i know that this is because I don't have the compile exported, but I have it exported in my Build.Gradle (Module App). but when i want to sync the gradle, this show me the next errors
this is my build.gradle (Module: App)
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "demontechsystemsecurity.trackingtool"
minSdkVersion 15
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
testCompile 'junit:junit:4.12'
}
I don't know what's really the problem because I opt by downloading all the sdk tools and
this is the build.gradle (Project: Project Name)
// 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:2.3.3'
// 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
}
if I add in the repositories google() it showme this
but is the same if I click over Upgrade plugin to version 2.3.3 and sync project this doesn't make any action
Add maven { url "https://maven.google.com" }
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}

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 - Failed to resolve

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

Categories

Resources