When I sync the gradle files it is showing the error :
Error:(26, 0) Gradle DSL method not found: 'ompile()'
Possible causes:The project 'Athletto' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper fileThe build file may be missing a Gradle plugin.
Apply Gradle plugin
I searched for various solutions but none of them worked.I don't know which plugin I have to use.Here are my gradle files :
build.gradle (Module ) :
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.hp.athletto"
minSdkVersion 16
targetSdkVersion 16
multiDexEnabled=true
versionCode 1
versionName "1.0"
}
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:23.1.1'
ompile 'com.android.support:design:23.0.1'
compile 'com.github.vajro:MaterialDesignLibrary:1.6'
compile 'com.android.support:cardview-v7:23.2.0'
compile('com.github.afollestad.material-dialogs:commons:0.8.5.6#aar') {
transitive = true
}
}
build.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.1.0-alpha1'
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
You have a typing error: change ompile to compile 'com.android.support:design:23.0.1' on line 3 of dependencies.
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.1.1'
ompile 'com.android.support:design:23.0.1'//<--error here
compile 'com.github.vajro:MaterialDesignLibrary:1.6'
compile 'com.android.support:cardview-v7:23.2.0'
compile('com.github.afollestad.material-dialogs:commons:0.8.5.6#aar') {
transitive = true
}
}
Related
I am trying to add facebook login. I am following the facebook quick starts. But I am getting the following error.
`
Error:(24, 0) Gradle DSL method not found: 'compile()'
Possible causes:<ul><li>The project 'FacebookAdd' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file</li><li>The build file may be missing a Gradle plugin.
Apply Gradle plugin</li>`
and the gradle.build files.
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
dependencies {
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
task clean(type: Delete) {
delete rootProject.buildDir
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.psycho.ayush.facebookadd"
minSdkVersion 17
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
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:appcompat-v7:24.1.1'
}
P.S. I have gone through almost every question related to this on this site.
It looks like you have two dependencies sections please try this:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:24.1.1'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
}
and remove this
dependencies {
compile 'com.facebook.android:facebook-android-sdk:[4,5)'}
Gradle sync failed: Gradle DSL method not found: 'minSdkVersdion(). I am using latest version of Android studio 2.0.
Here is my updated gradle.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId 'com.gkhindi'
minSdkVersdion 16
targetSdkVersion 23
versionCode 1
versionName '1.0.0'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
productFlavors {
}
}
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0'
}
}
allprojects {
repositories {
jcenter()
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/StartAppInApp-3.1.0.jar')
compile files('libs/Shutterbug-1.0.0.jar')
compile files('libs/Parse-1.11.0.jar')
compile files('libs/bolts-tasks-1.3.0.jar')
// compile 'com.android.support:support-v4:23.1.1'
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:design:23.3.0'
compile 'com.google.android.gms:play-services-ads:8.4.0'
compile 'com.google.android.gms:play-services-games:8.4.0'
compile 'com.android.support:recyclerview-v7:23.3.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.android.gms:play-services-analytics:8.4.0'
}
android {
useLibrary 'org.apache.http.legacy'
}
This is my final gradle. When i syn the gradle then I am receiving the error is 'Gradle sync failed: Gradle DSL method not found: 'minSdkVersdion()'.
There is a typo in your build.gradle
minSdkVersdion 16
instead of
minSdkVersion 16
i am getting the above error while importing the library from "compile 'com.github.jiahuanyu:PopSeekbar:0.2.3'" this dependency,
error:
Error:(27, 13) Failed to resolve: com.github.jiahuanyu:PopSeekbar:0.2.3
Show in File<br>Show in Project Structure dialog
i am struck with this, please help me...
My build.gradle content.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.example.admin.shopunter_user"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.google.android.gms:play-services:6.5.87'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'org.immutables:gson:2.1.0.alpha'
compile 'com.h6ah4i.android.widget.verticalseekbar:verticalseekbar:0.5.2'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.android.support:design:23.0.1'
compile 'com.github.jiahuanyu:PopSeekbar:0.2.3'
compile 'com.android.support:support-v4:23.0.1'
compile 'cz.msebera.android:httpclient:4.3.6'
compile 'com.android.support:recyclerview-v7:+'
}
Just add this in your build.gradle
dependencies {
compile 'com.github.jiahuanyu:PopSeekbar:0.2.3'
}
Then
Build > Clean Project Then Build > Rebuild Project
Then Click Invalidate Caches/Restart Options And Do Gradle (Sync)
I add this to buildscript{} to solve the problem.
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
I have looked at other related but none seems to Solve my Problem in Gradle.
Here is my Build Gradle (Module App )
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.abdul_000.project"
minSdkVersion 9
targetSdkVersion 21
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/android-support-v13.jar')
compile 'com.android.support:appcompat-v7:22.0.0'
}
// 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.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
dependencies {
compile 'com.android.support:support-v4:19.0.0'
compile fileTree(dir: 'libs', include: ['*.jar'])
} apply plugin: 'application'
allprojects {
repositories {
jcenter()
}
}
}
The are it gives me
"Error:(20, 0) Gradle DSL method not found: 'compile()'
Possible causes:The project 'Project' may be using a version of Gradle that does not contain the method.
Open Gradle wrapper file
The build file may be missing a Gradle plugin. Apply Gradle plugin"
What am I doing wrong ?
You cannot add compile dependencies to global build.gradle file. Removing the second dependencies block in your global build.gradle file would fix the error.
I am using android-studio 0.6.1 and have all necessary google repositories installed in SDK manager: however when I try to build a project, gradle says about unresolved dependency:
Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+
My build.gradle looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 12
targetSdkVersion 19
versionCode 1
versionName '0.1'
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile project(':library')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.google.android.gms:play-services:+'
compile 'com.google.maps.android:android-maps-utils:+'
}
I know I can just import all necessary instruments in library folder, however I would like to resolve this problem. Do you have any suggestions?
EDIT:
Found a way to solve it:
Looks like the problem was in absense of
compile 'com.android.support:support-v4:19.0.1'
in build.gradle, also I had to empty 'library' folder and delete the line in order to avoid 'duplicate packages' problem with support libraries:
compile project(':library')
So my final build.gradle file looks like this:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.11.+'
}
}
apply plugin: 'android'
android {
compileSdkVersion 19
buildToolsVersion '19.1.0'
defaultConfig {
minSdkVersion 12
targetSdkVersion 19
versionCode 1
versionName '1.0'
}
repositories {
mavenCentral()
}
buildTypes {
release {
runProguard false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
productFlavors {
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:19.+'
compile 'com.google.android.gms:play-services:4.4+'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
}
The error is
Unresolved dependencies:
Error:com.google.maps.android:android-maps-utils:+
I'd say double check that you've got the dependency correctly defined. Looking at the Map Utils website leads me to believe you might want to declare the dependency with a version.
Replace
compile 'com.google.maps.android:android-maps-utils:+'
to
compile 'com.google.maps.android:android-maps-utils:0.3+'
Do a Gradle Sync and everything should build correctly.
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
// Support Libraries
compile 'com.google.android.gms:play-services:4.1.32'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.google.maps.android:android-maps-utils:0.3+'
}
com.google.android.gms:play-services:3.1.36 can be downloaded by going to your SDK Manager and installing the Extras->Google Repository package (you may want to install the Extras->Android Support Repository as well while you are there). These allow Gradle to automatically use these resources without the need for library projects or jars manually added to your project.
Try to replace this:
compile 'com.google.maps.android:android-maps-utils:0.3+'
with this
compile 'com.google.android.gms:play-services-maps:9.4.0'