Error:(28, 0) Gradle DSL method not found: 'compile()' - java

here is my code of build.gradle
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
applicationId "com.shadibazzar.delhibookstore"
minSdkVersion 15
targetSdkVersion 24
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.2'
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
classpath 'com.google.gms:google-services:3.0.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile project(":volley")
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
}
Error:(28, 0) Gradle DSL method not found: 'compile()'
Possible causes:
The project 'Delhi Book Store' may be using a version of Gradle that
does not contain the method.
The build file may be missing a Gradle plugin.

Related

I m Using volleyplus and volley libraries in Signal android project

android {
compileSdkVersion 23
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "testing.gps_service"
minSdkVersion 11
targetSdkVersion 22
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.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'dev.dworks.libs:volleyplus:+'
compile 'com.android.support.constraint:constraint-layout:1.0.0-alpha7'
testCompile 'junit:junit:4.12'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
}
repositories
{
mavenCentral()
google()
}
apply plugin: 'kotlin-android-extensions'
-------------------------------------------------------
## I'm new to Android, currently working on FYP, as I run my project, an
error is occurred.##
Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Compile with
compile 'dev.dworks.libs:volleyplus:0.1.4'
hope that will help
Use this Link for Upload Image "https://www.simplifiedcoding.net/android-upload-image-to-server/"

Adding Kotlin to existing Java project breaks Android Studio gradle messages errors

I am very new to Gradle and Android but since I have added Kotlin to my project anytime I get an error in Android Studio I need to go through the Gradle console which does not give me any of the nice stack traces or pathing by default. In the Gradle messages view where errors did appear now I only get
Error:Execution failed for task ':app:kaptDebugKotlin'.
Internal compiler error. See log for more details
Is this the intended functionality because it seems to work ok in the jetbrains example projects.
My Project Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
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 {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
My App level Gradle file
buildscript {
ext.kotlin_version = '1.1.4-2'
repositories {
jcenter()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
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'
}
}
sourceSets {
main.java.srcDirs += 'src/main/java'
main.java.srcDirs += 'src/main/kotlin'
}
}
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.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
I did not see any problems,May be you can see here [Gradle Console] ,it print all bulid log.you can see error details,and post error message.
That is old config,May be you can config new like this:
1.remove all about Kotlin config.
2.use the menu->tools-->Kotlin-->Configure Kotlin in project-->Android with Gradle
3.change version to 1.1.2-2, the version 1.1.4-2 for gradle:2.3.3 has something bug
4.Sync gradle
other. The new version use extensions only config this:
apply plugin: 'kotlin-android-extensions'
dont use this:
dependencies {
classpath "org.jetbrains.kotlin:kotlin-android-extensions:$kotlin_version"
}
ultimate,config like this
Project Gradle file
buildscript {
ext.kotlin_version = '1.1.2-2'
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
App level Gradle file
apply plugin: 'kotlin-kapt'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.test.andrew.ccombo_breaker"
minSdkVersion 19
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'
}
}
}
kapt {
generateStubs = true
}
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.1'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"
compile 'com.google.dagger:dagger:2.9'
kapt 'com.google.dagger:dagger-compiler:2.9'
testCompile 'junit:junit:4.12'
}
Kotlin official doc

Failed to resolve: com.android.volley:volley:1.0.0

Android Studio displayed this error message when I added the following line to the build.gradle line to the dependencies: compile 'com.android.volley:volley:1.0.0'
apply plugin: 'com.android.application'
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.parse.starter"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.2.0'
compile 'com.parse.bolts:bolts-tasks:1.3.0'
compile 'com.parse:parse-android:1.13.0'
compile 'com.android.support.constraint:constraint-layout:1.0.0-beta4'
compile 'com.google.code.gson:gson:2.8.0'
compile 'org.jetbrains:annotations-java5:15.0'
compile 'com.android.volley:volley:1.0.0'
}
See if you have jcenter() in your repositories in your project gradle.
For example:
allprojects {
repositories {
jcenter()
maven {
}
ivy {
}
}
}

Error:(18, 0) Could not find method android() for arguments

i'am new on android application, i imported an application and i get this error dont know what to do.. someone here can help me!
there is my build.gradle file
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.0 rc3"
}
and there is my app/build.gradle
apply plugin: 'com.android.application'
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
defaultConfig {
applicationId "com.codeandcoder.finalguide"
minSdkVersion 15
targetSdkVersion 22
versionCode 2
versionName "1.1"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
}
Move this:
android {
compileSdkVersion 22
buildToolsVersion "23.0.0 rc3"
}
and
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.google.android.gms:play-services:7.5.0'
compile 'com.android.support:appcompat-v7:22.2.1'
}
to module/build.gradle

Error:(26, 17) Failed to resolve: junit:junit:4.12 android studio 1.5

well i can't figure it out i have tried every possible solution i found but nothing worked like this one
Error:(23, 17) Failed to resolve: junit:junit:4.12
the main difference between those two questions is my error is (26,17) and his is (23,17)
here is my build.glade code
apply plugin: 'com.android.application'
repositories {
maven { url 'http://repo1.maven.org/maven2' }
jcenter { url "http://jcenter.bintray.com/" }
}
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.vaio.myapplication2"
minSdkVersion 15
targetSdkVersion 23
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:23.1.1'
compile 'com.android.support:design:23.1.1'
}

Categories