Android Gradle method not found : 'compile()' - android

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'
}

Related

Could not find 'com.afollestad:material-dialogs:0.7.9.1'

My build.gradle(:app) code
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "25.0.3"
defaultConfig {
applicationId "tk.yurkiv.recipes"
minSdkVersion 19
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
repositories {
maven {
url "https://jitpack.io"
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:28.0.0'
compile 'com.android.support:design:27.0.0'
compile 'com.android.support:cardview-v7:28.0.0'
compile 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.jakewharton:butterknife:6.1.0'
annotationProcessor 'com.jakewharton:butterknife:6.1.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.joooonho:selectableroundedimageview:1.0.1'
compile 'com.akexorcist:RoundCornerProgressBar:1.2.3'
compile 'com.vlonjatg.android:progress-activity:1.1.1'
compile 'me.zhanghai.android.materialprogressbar:library:1.0.2'
compile('com.github.florent37:materialviewpager:1.1.0#aar') {
transitive = true
}
compile 'com.afollestad:material-dialogs:0.7.9.1'
compile 'org.adw.library:discrete-seekbar:1.0.0'
compile 'com.github.leonardoxh:fake-search-view:0.3.1'
}
Build Output
Could not resolve all files for configuration ':app:debugCompileClasspath'.
> Could not find com.afollestad:material-dialogs:0.7.9.1.
Searched in the following locations:
file:/E:/Android/Sdk/extras/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
file:/E:/Android/Sdk/extras/google/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/google/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
file:/E:/Android/Sdk/extras/android/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
file:/E:/Android/Sdk/extras/android/m2repository/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://dl.google.com/dl/android/maven2/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://dl.google.com/dl/android/maven2/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://jcenter.bintray.com/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://jcenter.bintray.com/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
https://jitpack.io/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.pom
https://jitpack.io/com/afollestad/material-dialogs/0.7.9.1/material-dialogs-0.7.9.1.jar
Required by:
project :app
According to this issue on the library repository
https://github.com/afollestad/material-dialogs/issues/990
The library is moved to JCenter so in your build.gradle make sure you have this line jcenter()
allprojects {
repositories {
jcenter()
...
}
}
In any new project, this code is added by default
Replace this:
compile 'com.afollestad:material-dialogs:0.7.9.1'
with this:
implementation 'com.afollestad.material-dialogs:core:3.3.0'
Looks like you are running a legacy project which needs a lot of refactoring.
NOTE: This solution might work for the specific question but not for the project. Update your project to fix every other issues.
Edit: Also see AmrDeveloper's answer below assuming the project is old.

Android Studio 2.3 update : Warning:Using incompatible plugins for the annotation processing: android-apt. This may result in an unexpected behavior

So, I have read all the questions I could find on this site regarding this issue. I have also had a chat in comments with one of the developer with similar issue, who was able to solve it.
I dont have apt or annotationProcessor written any where in my gradle scripts.
I dont have the word android-apt written anywhere in my code. I even went ahead and checked out all the libraries. That were included in my project.
This is a really big problem and needs to be solved.
I am attaching the modified build.gradle below, Please suggest :
apply plugin: 'com.android.application'
apply plugin: 'realm-android'
android {
dexOptions {
jumboMode = true
}
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.legalimpurity.indiancourts"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode rootProject.ext.versionCode
versionName rootProject.ext.versionName
multiDexEnabled true
vectorDrawables.useSupportLibrary = true;
}
buildTypes {
release {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
signingConfigs {
}
dataBinding {
enabled = true
}
}
//For Facebook i guess
repositories {
mavenCentral()
maven {
url "https://jitpack.io"
}
maven { url 'https://maven.fabric.io/public' }
}
def var = dependencies {
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.google.android.gms:play-services-auth:9.4.0'
compile 'com.google.android.gms:play-services-analytics:9.4.0'
compile 'com.google.android.gms:play-services-plus:9.4.0'
compile 'com.google.android.gms:play-services-ads:9.4.0'
compile 'com.google.android.gms:play-services-identity:9.4.0'
// compile 'com.google.android.gms:play-services-gcm:9.4.0'
compile 'com.google.firebase:firebase-messaging:9.4.0'
compile "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:cardview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:recyclerview-v7:${rootProject.ext.supportLibVersion}"
compile "com.android.support:design:${rootProject.ext.supportLibVersion}"
compile "com.android.support:support-v4:${rootProject.ext.supportLibVersion}"
compile('com.github.ozodrukh:CircularReveal:2.0.1#aar') {
transitive = true;
}
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile 'com.android.support:multidex:1.0.1'
// compile 'com.joanzapata.pdfview:android-pdfview:1.0.4#aar'
compile 'com.github.barteksc:android-pdf-viewer:2.4.0'
compile 'com.wdullaer:materialdatetimepicker:3.1.3'
compile 'com.facebook.android:account-kit-sdk:4.+'
compile 'com.android.volley:volley:1.0.0'
// compile 'com.facebook.android:facebook-android-sdk:4.6.0'
// compile 'com.satsuware.lib:usefulviews:2.3.6'
compile 'com.hkm:hkmprocessbuttons:1.2.4'
compile 'com.github.thorbenprimke:realm-searchview:0.9.6'
compile 'com.jakewharton:butterknife:8.5.1'
// compile 'com.github.amlcurran.showcaseview:library:5.4.3'
compile 'com.github.deano2390:MaterialShowcaseView:1.1.0'
// compile 'com.zaihuishou:expandablerecycleradapter-databinding:1.0.0'
// compile 'com.squareup.picasso:picasso:2.5.2'
// compile 'com.legalimpurity.expandablerecyclerview:expandable-recyclerview:1.0'
compile project(':agendacalendarview')
compile project(':expandablelibrary')
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
compile 'com.android.support:support-v4:25.+'
}
apply plugin: 'com.jakewharton.butterknife'
apply plugin: 'com.google.gms.google-services'
configurations.all {
resolutionStrategy {
force "com.android.support:support-annotations:25.2.0"
}
}
Older versions of Realm use android-apt. You should upgrade your realm-android plugin version.
Replace
classpath "io.realm:realm-gradle-plugin:1.2.0"
with
classpath "io.realm:realm-gradle-plugin:3.1.2"
and then apply plugin
apply plugin: 'realm-android'

how to fix error gradle?

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.

Error:(8, 42) error: cannot find symbol class AdapterViewCompat

My compiledSdk version is 23 and targetsdkversion is 23 and I am getting this error cannot find symbol class AdapterViewCompat can anyone help ?
My compiledSdk version is 23 and targetsdkversion is 23 and I am getting this error cannot find symbol class AdapterViewCompat can anyone help ?
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.3.1'
buildscript {
repositories {
maven { url "http://dl.bintray.com/populov/maven" }
mavenCentral()
}
dependencies {
// replace with the current version of the android-apt plugin
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
classpath 'com.android.tools.build:gradle:1.3.0'
}
}
repositories {
mavenCentral()
mavenLocal()
}
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.squareup.okhttp:okhttp-android-support:2.5.0'
compile 'com.squareup.okio:okio:1.6.0'
compile files('libs/CleverTapSDKValidator-20151217.jar')
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
// if you have multiple outputs (when using splits), you may want to have other index than 0
// You can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log'
}
}
android {
compileSdkVersion 23
buildToolsVersion '22.0.1'
defaultConfig {
applicationId "com.vedicrishiastro.kundli"
minSdkVersion 15
targetSdkVersion 23
versionCode 6
versionName "Beta 1.4"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
/*apt {
arguments {
//androidManifestFile variant.outputs[0].processResources.manifestFile
// if you have multiple outputs (when using splits), you may want to have other index than 0
// If you're using flavors you should use the following line instead of hard-coded packageName
resourcePackageName android.defaultConfig.applicationId
// You can set optional annotation processing options here, like these commented options:
// logLevel 'INFO'
// logFile '/var/log/aa.log'
}
}*/
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.clevertap.android:clevertap-android-sdk:2.0.5'
compile 'com.google.android.gms:play-services'
compile 'com.android.support:support-v4'
compile project(':multilevelexpindlistview')
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.android.support:appcompat-v7:22.1.0'
compile 'com.android.support:support-annotations:22.2.0'
compile 'com.android.support:support-v4:23.1.0'
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
compile 'com.android.support:cardview-v7:21.0.+'
compile 'com.github.traex.rippleeffect:library:1.3'
compile 'com.android.support:recyclerview-v7:21.0.+'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.android.support:design:22.2.0'
compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'de.hdodenhof:circleimageview:1.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile project(':library')
compile 'com.github.medyo:fancybuttons:1.5#aar'
compile 'com.jpardogo.materialtabstrip:library:1.1.0'
compile 'com.melnykov:floatingactionbutton:1.3.0'
compile 'com.google.android.gms:play-services-analytics:8.3.0'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.github.lzyzsd:circleprogress:1.1.0#aar'
}
android {
lintOptions {
abortOnError false
checkReleaseBuilds false
}
}
apply plugin: 'android-apt'
apply plugin: 'com.google.gms.google-services'
cannot find symbol class AdapterViewCompat
android.support.v7.internal.widget.AdapterViewCompat;
AdapterViewCompat Doesn't exist in Appcompat 23 Level . You should use 22.
buildToolsVersion "22.0.1"
if you have existing code then change AdapterViewCompat to
AdapterView and import android.widget.AdapterView;
if you are
writing new code then use AdapterView instead AdapterViewcompact as
AdapterViewCompact deprecated in api v23 or higher

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