how to fix error gradle? - android

I am using the Gradle build system bundled with Android Studio. So far, I am able to build multi-project setups using dependencies that are stored in my project structure. when i build my project. i have a error:
Error:(37, 13) Failed to resolve: 'com.parse.bolts:bolts-android:1.+' Show in FileShow in Project Structure
Error:(37, 13) Failed to resolve: 'com.parse:parse-android:1.+' Show in FileShow in Project Structure
I try to insert mavenCentral(). but it's working:
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
build.gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "vaeapp.gamecard.vn"
minSdkVersion 14
targetSdkVersion 19
multiDexEnabled = true
versionCode 4
versionName "1.3.4"
ndk {
moduleName "gc"
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
//compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:appcompat-v7:23.2.0'
compile 'com.google.code.gson:gson:2.2.4'
compile 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
compile 'com.facebook.android:facebook-android-sdk:4.2.0'
// compile 'com.android.support:appcompat-v7:20.0.0'
// compile 'com.google.android.gms:play-services:+'
compile 'com.google.android.gms:play-services:4.0.30'
compile files('libs/activation.jar')
compile files('libs/additionnal.jar')
compile files('libs/commons-io-2.4.jar')
compile files('libs/error-reporter.jar')
//compile files('libs/httpclient-4.0.1.jar')
compile files('libs/mail.jar')
compile files('libs/universal-image-loader-1.9.3.jar')
compile fileTree(dir: 'libs', include: 'Parse-*.jar')
// compile 'com.parse:parse-android:1.10.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'com.parse:parse-android:1.+'
}

Add this inside your android tag:
android {
//...
//...
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
//...
}
Hope it helps you.

Related

Failed to resolve: com.afollestad.material-dialogs: core:0.8.5.2

I, m using Android Studio 2.1.2, and in my project I hava a problem with com.afollestad.material-dialogs:core:0.8.5.2, when I add com.afollestad.material-dialogs to my Gradle, error was show: Failed to resolve: com.afollestad.material-dialogs:core:0.8.5.2,
Here is my Gradle:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
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 {
jcenter()
mavenLocal()
mavenCentral()
maven { url "https://jitpack.io" }
}
And this is my Gradle: app
apply plugin: 'com.android.application'
android {
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:25.3.1'
}
compileSdkVersion 25
buildToolsVersion "24.0.2"
defaultConfig {
applicationId "com.panaceasoft.mokets"
minSdkVersion 14
targetSdkVersion 24
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 files('libs/android-async-http-1.4.4.jar')
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:design:25.3.1'
compile 'com.android.support:palette-v7:25.3.1'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.mcxiaoke.volley:library:1.0.+'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.pnikosis:materialish-progress:1.5'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-maps:9.4.0'
compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.github.rey5137:material:1.2.2'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.stripe:stripe-android:2.0.0'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.google.firebase:firebase-core:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile 'com.google.firebase:firebase-crash:9.4.0'
compile 'me.zhanghai.android.materialprogressbar:library:1.1.4'
compile('com.afollestad.material-dialogs:core:0.8.5.2#aar') {
transitive = true
}
androidTestCompile 'com.android.support:support-annotations:25.1.3'}
apply plugin: 'com.google.gms.google-services'
And this is my SDK manager:
when I remove
compile('com.afollestad.material-dialogs:core:0.8.5.2#aar') {
transitive = true
}
everything is fine and gradle build finished with no errors,
You should use the latest version instead of aar.
compile 'com.afollestad.material-dialogs:core:0.9.6.0'
NOTE
You should upgrade your versions
classpath 'com.google.gms:google-services:3.2.0'
classpath 'com.android.tools.build:gradle:3.1.2'
Then
compileSdkVersion 27
buildToolsVersion "27.0.3"
Then
compile 'com.android.support:appcompat-v7:27.1.1'
Finally
repositories {
jcenter()
// google()
maven {
url "https://maven.google.com"
}
}
try with the latest version of the library
compile 'com.afollestad.material-dialogs:core:0.9.6.0'

Gradle error with compile 'com.facebook.android:facebook-share:[4,5)'

apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.1'
defaultConfig {
applicationId "com.android.login_androidlogin"
minSdkVersion 23
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'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
//CounterFAB
compile 'com.github.andremion:counterfab:1.0.1'
compile 'com.facebook.android:facebook-share:[4,5)'
compile 'com.github.d-max:spots-dialog:0.7#aar'
compile 'io.paperdb:paperdb:2.1'
compile 'com.stepstone.apprating:app-rating:2.0.0'
compile 'com.github.rey5137:material:1.2.4'
compile 'com.github.mancj:MaterialSearchBar:0.7.1'
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile 'com.cepheuen.elegant-number-button:lib:1.0.2'
compile 'com.android.support:design:26.+'
compile 'com.android.support:appcompat-v7:26.+'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-database:10.2.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:cardview-v7:26.+'
compile 'com.android.support:recyclerview-v7:26.+'
compile 'com.firebaseui:firebase-ui-database:1.2.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
After i add compile com.facebook.android:facebook-share:[4,5) into the build.gradle, then it shows the error.
Error:Failed to resolve: com.android.support:support-annotations:27.0.1
Error:Failed to resolve: com.android.support:appcompat-v7:27.0.1
Error:Failed to resolve: com.android.support:customtabs:27.0.1
Error:Failed to resolve: com.android.support:cardview-v7:27.0.1
Error:Failed to resolve: com.android.support:support-v4:27.0.1
Error:Failed to resolve: com.android.support:support-core-utils:27.0.1
So whats the problem and how to solve it ?
All the code is working well before i add the compile com.facebook.android:facebook-share:[4,5)
To use support libraries starting from version 26.0.0 you need to add Google's Maven repository to your project's build.gradle file as described here: https://developer.android.com/topic/libraries/support-library/setup.html
allprojects {
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
For Android Studio 3.0.0 and above you can just write google() like this
allprojects {
repositories {
jcenter()
google()
}
}
And for Facebook SDK you have to add mavenCentral() to the buildscript { repositories {}} section as mentioned here:
https://developer.android.com/topic/libraries/support-library/setup.html
like this:
buildscript {
repositories {
mavenCentral()
}
}
You can also specify the version like
compile 'com.facebook.android:facebook-share:4.28.0'
instead of [4,5)
you can get the latest version from their github:
https://github.com/facebook/facebook-android-sdk

Error adding library Room Persistence

I'm starting to work with room persistence
I added the room in the gradle and the error below appeared:
Error:Failed to resolve: annotationProcessor
href="openFile:C:/.../app/build.gradle">Open File
This error appears when I synchronize the gradle
How can I resolve this issue?
This is the gradle project:
// 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.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.google.com' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
app gradle:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
dataBinding {
enabled = true
}
defaultConfig {
applicationId "com.app.bob.app"
minSdkVersion 22
targetSdkVersion 25
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:25.3.0'
compile 'com.android.support:support-annotations:25.3.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile 'com.android.support:support-v4:25.3.0'
testCompile 'junit:junit:4.12'
compile 'com.android.support:recyclerview-v7:25.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton:butterknife:8.7.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
compile 'com.android.support:cardview-v7:25.3.0'
compile 'android.arch.persistence.room:runtime: 1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler: 1.0.0-alpha5'
compile 'android.arch.lifecycle:runtime:1.0.0-alpha5'
compile 'android.arch.lifecycle:extensions:1.0.0-alpha5'
annotationProcessor 'android.arch.lifecycle:compiler:1.0.0-alpha5'
testCompile 'android.arch.persistence.room:testing:1.0.0-alpha5'
compile 'android.arch.persistence.room:rxjava2:1.0.0-alpha5'
}
Remove all whitespace from your compile values. IOW, replace:
compile 'android.arch.persistence.room:runtime: 1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler: 1.0.0-alpha5'
with:
compile 'android.arch.persistence.room:runtime:1.0.0-alpha5'
annotationProcessor 'android.arch.persistence.room:compiler:1.0.0-alpha5'

Android Gradle method not found : 'compile()'

Can't run an android application due to below error of gradle .
Gradle DSL method not found : 'compile()'
Possible Causes :
The project XXXX may be using a version of Gradle that does not contain the method .
The build file may be missing a Gradle Plugin .
Please help how to resolve this .
EDIT :
File build.gradle
PFB my build.gradle file from project , most the file seems to be added in dependencies but why the issue cannot address the same .
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "xxxxxxxx"
minSdkVersion 15
targetSdkVersion 23
versionCode 2
versionName "1.2"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
android {
useLibrary 'org.apache.http.legacy'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:design:23.4.0'
compile 'me.zhanghai.android.materialprogressbar:library:1.1.6'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.sa90.materialarcmenu:library:1.4.1'
compile files('libs/jxl.jar')
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.github.clans:fab:1.6.4'
compile 'com.android.support:cardview-v7:23.4.0'
compile files('libs/acra-4.6.1.jar')
compile('com.crashlytics.sdk.android:crashlytics:2.6.1#aar') {
transitive = true;
}
compile 'commons-codec:commons-codec:1.10'
compile "com.android.support:support-v4:+"
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
}
You have dependency in the project build.gradle, make sure to place it in the app/build.gradle.
For example in app/build.gradle
dependencies {
compile 'com.android.support:appcompat-v7:25.2.0'
}

Could not find method complie() for arguments [com.google.android.gms:play-services-gcm:7.5.0]

Error:(51) A problem occurred evaluating project ':app'.
Could not find method complie() for arguments [com.google.android.gms:play-services-gcm:7.5.0] on project ':app'.
How to fix this error?
Please have a look at build.gradle file
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
applicationId "XYZ"
minSdkVersion 14
targetSdkVersion 22
versionCode 13
versionName "3.0.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:22.2.1'
compile 'com.squareup.okio:okio:1.4.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.akexorcist:RoundCornerProgressBar:1.2.0'
compile 'com.github.lzyzsd:circleprogress:1.1.0#aar'
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'joda-time:joda-time:2.7'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.4'
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
compile 'com.google.android.gms:play-services-analytics:7.5.0'
complie 'com.google.android.gms:play-services-gcm:7.5.0'
compile 'com.balysv:material-ripple:1.0.2'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile('com.crashlytics.sdk.android:crashlytics:2.4.0#aar') {
transitive = true;
}
}
Replace
complie 'com.google.android.gms:play-services-gcm:7.5.0'
with
compile 'com.google.android.gms:play-services-gcm:7.5.0'
The error is basically saying that gradle does not know what complie is.

Categories

Resources