i imported a project into a workspace in Android studio, and the file structure of the project does not seem in a proper condition as shown in image-1.
Also, when I tried to build and compile the project I received the following error:
Error:(20, 0) Could not find method compile() for arguments [directory 'libs'] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Open File
also in the project,the build.gradle(project) exists twice and build.gradle(app) exists once as shown in image-2
please have a look at the below gradle files, and please let me know how to correct this error and why I am getting it.
build.gradle(app):
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
def AAVersion = '3.2' // '4.2.0'
dependencies {
apt "org.androidannotations:androidannotations:$AAVersion"
compile "org.androidannotations:androidannotations-api:$AAVersion"
}
apt {
arguments {
androidManifestFile variant.outputs[0].processResources.manifestFile
resourcePackageName 'eu.man.m24wsapp'
}
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
defaultConfig {
applicationId "eu.man.m24wsapp"
targetSdkVersion 25
minSdkVersion 10
versionCode 1
versionName "1.1.18"
}
signingConfigs {
release {
storeFile file("../wsapp.keystore")
storePassword "7s5zhgknsIXxHgw"
keyAlias "man_mobile24"
keyPassword "manmobile242014"
}
}
lintOptions {
checkReleaseBuilds false
// Or, if you prefer, you can continue to check for errors in release builds,
// but continue the build even when errors are found:
abortOnError false
}
buildTypes {
release {
minifyEnabled false // 15.05.2017 avk, enables/disables proguard
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
applicationVariants.all { variant ->
variant.outputs.each { output ->
def name = output.outputFile.name.replace("app", "Man");
name = name.replace(".apk", "-" + defaultConfig.versionName + "-" + defaultConfig.versionCode + ".apk");
output.outputFile = new File(output.outputFile.parent, name)
}
}
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile project(':appcompat')
compile project(':securepreferences')
compile 'com.android.support:support-v4:25.2.0' // .0.1
compile 'com.google.android.gms:play-services:4.3.23'
// compile 'com.google.android.gms:play-services-maps:10.0.1'
// compile 'com.google.android.gms:play-services-location:10.0.1'
// AVK 05.02.2017 compile 'com.github.chrisbanes.photoview:library:1.2.2'
compile 'com.github.chrisbanes.photoview:library:1.2.4'
compile 'com.google.code.gson:gson:2.7' // 2.4
// AVK 5.2.2017 compile 'com.squareup:otto:1.3.6'
compile 'com.squareup:otto:1.3.8'
// AVK 5.2.2017 compile 'com.squareup.okhttp:okhttp:1.5.4'
// AVK 5.2.2017 compile 'com.squareup.okhttp:okhttp:2.5.0'
// AVK 5.2.2017 compile 'com.squareup.okhttp:okhttp:2.6.0' // oder
compile 'com.squareup.okhttp:okhttp:2.2.0' // 7.5' // oder
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' // 7.5' // oder
// https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp
// AVK 5.2.2017 compile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
compile 'com.squareup.picasso:picasso:2.4.0'
//compile 'com.squareup.picasso:picasso:2.2.0'
// AVK 5.3.2017 compile 'com.squareup.picasso:picasso:2.4.0'
// AVK 3.2.2017 compile 'com.squareup.retrofit:retrofit:1.5.1'
// AVK 3.2.2017 compile group: 'com.squareup.retrofit', name: 'retrofit', version: '1.9.0'
compile 'com.squareup.retrofit:retrofit:1.8.0'
// AVK 5.2.2017 compile 'com.squareup.retrofit2:retrofit:2.1.0'
}
**build.gradle(project)**:
// 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.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' // 1.8?
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('app/libs/android-viewbadger.jar')
compile files('app/libs/iDappsImagesLib_v0.2.jar')
compile files('app/libs/iDappsToolsLib_v0.1.jar')
compile files('gradle/wrapper/gradle-wrapper.jar')
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
image-1:
image-2:
image-3 project properties:
image-4 gradle path:
Move quoted block from build.gradle(project) to build.gradle(app) as the compile and android comes from the application plugin
build.gradle(project)
// 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.3.0'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7' // 1.8?
}
}
allprojects {
repositories {
jcenter()
mavenCentral()
}
}
build.gradle(app)
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile files('app/libs/android-viewbadger.jar')
compile files('app/libs/iDappsImagesLib_v0.2.jar')
compile files('app/libs/iDappsToolsLib_v0.1.jar')
compile files('gradle/wrapper/gradle-wrapper.jar')
}
android {
compileSdkVersion 25
buildToolsVersion '25.0.2'
dexOptions {
incremental true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
Related
In my android studio build gradle is failed i dont know how so then i check the log and i saw this error
Error:Could not find method compile() for arguments
[com.android.support:recyclerview-v7:25.3.1] on object of type
org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.
Please install the Android Support Repository from the Android SDK
Manager. Open Android SDK Manager
then i check it but android support respository is already installed version 47.0.0 i restart android studio but it shows same error how i solve this error from android studio please help me to solve this problem?
I think something is wrong on my build gradle but i cant get it where is wrong or what happens
here is my build gradle sample-------
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven {
url "https://github.com/Blox/blox-android-sdk-releases/raw/master/"
}
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.android.tools.build:gradle:2.3.0'
ext {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
minSdkVersion = 14
targetSdkVersion = 23
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
lintAbortOnError = false
// Blox SDK version
ext.qbSdkVersion = '3.3.1'
ext.versionName = '3.3.0'
ext.testRunnerVersion = "0.4.1"
// Dependency versions
playServicesVersion = '10.2.1'
supportV4Version = '23.1.1'
appcompatV7Version = '23.1.1'
recyclerviewV7Version = '23.2.1'
supportAnnotationsVersion = '23.1.1'
designVersion = '23.1.1'
uilVersion = '1.9.0'
glideVersion = '3.6.1'
pullToRefreshVersion = '3.2.3'
stickyListHeaders = '2.7.0'
robotoTextViewVersion = '2.4.3'
stickersVersion = '0.7.3'
crashlyticsVersion = '2.2.2'
}
compile "com.android.support:recyclerview-v7:25.3.1"
compile "com.android.support:recyclerview-v7:27.1.1"
compile "com.android.support:cardview-v7:23.+"
compile "com.android.support:support-annotations:${rootProject.supportAnnotationsVersion}"
compile "com.navercorp.pulltorefresh:library:${rootProject.pullToRefreshVersion}#aar"
compile("com.crashlytics.sdk.android:crashlytics:${rootProject.crashlyticsVersion}#aar") {
transitive = true;
}
compile 'com.github.bumptech.glide:glide:3.6.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
// Blox SDK version
qbSdkVersion = '3.3.1'
versionName = '3.4.1'
testRunnerVersion = "0.4.1"
allprojects {
repositories {
maven { url 'http://maven.pipe.com/artifactory/factory' }
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
}`
Android \ build gradle
`apply plugin: 'com.android.application'
android {
// signingConfigs {
// config {
// keyAlias 'abc'
// keyPassword 'abc'
// storeFile file(D:\Users\Lake\Desktop\myap_keystore\myap.jks)
// storePassword 'abc'
// }
// defaultConfig {
// applicationId "abcd.com.myap"
// minSdkVersion 19
// targetSdkVersion 23
// versionCode 1
// versionName "1.0"
// }
// }
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "abc.com.myap"
minSdkVersion 23
targetSdkVersion 25
versionCode 1
versionName "1.0"
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
// signingConfig signingConfigs.config
resValue "string", "versionName", "Blox WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
}
// debug {
resValue "string", "versionName", "Blox WebRTC\nBuild version " + defaultConfig.getVersionName()
signingConfig signingConfigs.debug
}
// signingConfig signingConfigs.config
// debuggable true
// }
}
}
def pipeSdkVersion = '0.15.1'
dependencies {
compile "com.blox-android-sdk-videochat-webrtc:$rootProject.qbSdkVersion"
compile(project(":sample-core"))
// online dependencies, from remote repository, aar files
compile fileTree(include: ['*.jar'], dir: 'libs')
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'
testCompile 'junit:junit:4.12'
compile 'com.google.firebase:firebase-core:9.2.0'
compile 'com.android.support:design:25.3.1'
compile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services-appindexing:9.8.0'
compile 'com.android.support:gridlayout-v7:25.3.1'
compile 'com.android.support:support-v4:25.3.1'
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.google.android.gms:play-services:11.0.4'
compile 'com.github.apl-devs:intro:v4.2.2'
compile("vc908.stickers:sfactory:$pipeSdkVersion") {
transitive = true;
}
compile("vc908.stickers:gcmintegration:$pipeSdkVersion") {
transitive = true;
}
compile("vc908.stickers:jpushintegration:$pipeSdkVersion") {
transitive = true;
}
compile files('libs/StartAppInApp-3.6.3.jar')
compile 'com.blox:blox-android-sdk-core:2.5.1'
compile('com.blox:blox-android-sdk-chat:2.5.1#aar') {
transitive = true
}
compile "com.blox:blox-android-sdk-chat:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-content:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-customobjects:$rootProject.qbSdkVersion"
compile "com.blox:quickblox-android-sdk-location:$rootProject.qbSdkVersion"
compile ("com.blox:blox-android-sdk-messages:$rootProject.qbSdkVersion" )
compile "com.github.johnkil.android-robototextview:robototextview:${rootProject.robotoTextViewVersion}"
apply plugin: 'com.google.gms.google-services'
}
`
[NOTE:I am using javascript snippets here for showing code properly]
Replace compile with implementation and you should be good.
(compile was recently deprecated and replaced by implementation or api)
You are adding these dependencies to build.gradle(Project)
compile "com.android.support:recyclerview-v7:25.3.1"
compile "com.android.support:recyclerview-v7:27.1.1"
compile "com.android.support:cardview-v7:23.+"
compile "com.android.support:support-annotations:${rootProject.supportAnnotationsVersion}"
compile "com.navercorp.pulltorefresh:library:${rootProject.pullToRefreshVersion}#aar"
compile("com.crashlytics.sdk.android:crashlytics:${rootProject.crashlyticsVersion}#aar") {
transitive = true;
}
compile 'com.github.bumptech.glide:glide:3.6.1'
Instead put dependencies in build.gradle(Module:app) and replace compile with implementation as 'compile' is obsolete and has been replaced with 'implementation'
i changed dependencies with the code:
dependencies {
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}
Worked for me
When I migrate to com.android.tools.build:gradle:3.0.0-beta3 and Gradle 4.1, I am seeing the following error:
Caused by: org.gradle.api.artifacts.UnknownConfigurationException: Configuration with name 'compileClasspath' not found.
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.createNotFoundException(DefaultConfigurationContainer.java:123)
at org.gradle.api.internal.DefaultNamedDomainObjectCollection.getByName(DefaultNamedDomainObjectCollection.java:229)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:113)
at org.gradle.api.internal.artifacts.configurations.DefaultConfigurationContainer.getByName(DefaultConfigurationContainer.java:48)
at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:884)
at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:996)
at com.android.build.gradle.internal.LintGradleProject$ProjectSearch.getProject(LintGradleProject.java:785)
at com.android.build.gradle.internal.LintGradleClient.createLintRequest(LintGradleClient.java:193)
at com.android.tools.lint.LintCliClient.run(LintCliClient.java:151)
at com.android.build.gradle.internal.LintGradleClient.run(LintGradleClient.java:209)
at com.android.build.gradle.tasks.Lint.runLint(Lint.java:365)
at com.android.build.gradle.tasks.Lint.lintSingleVariant(Lint.java:335)
Here is my directory structure:
android-db
/db
/build.gradle
settings.gradle
/android-common
build.gradle
/common
build.gradle
android-db/db/build.gradle is the following:
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
abortOnError false
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
def jenkinsBuildNumber = {
System.getenv().BUILD_NUMBER?.toInteger() ?: 999999
}
// Change this when we upgrade the library version
def buildVersion = {
'1.0' + "." + jenkinsBuildNumber()
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'io.reactivex.rxjava2:rxandroid:2.0.1'
implementation 'io.reactivex.rxjava2:rxjava:2.0.1'
implementation project(path: ':android-common:common', configuration: 'default')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
testImplementation "org.robolectric:robolectric:3.0"
implementation 'com.annimon:stream:1.1.5'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation 'com.google.code.gson:gson:2.4'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
}
android-db/android-common/common/build.gradle is the following:
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-beta3'
}
}
apply plugin: 'com.android.library'
android {
compileSdkVersion 25
buildToolsVersion '25.0.3'
defaultConfig {
minSdkVersion 15
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
abortOnError false
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
}
dataBinding {
enabled = true
}
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
google()
}
def jenkinsBuildNumber = {
System.getenv().BUILD_NUMBER?.toInteger() ?: 999999
}
// Change this when we upgrade the library version
def buildVersion = {
'1.0' + "." + jenkinsBuildNumber()
}
ext {
supportLibVersion = '25.3.1'
playServicesVersion = '10.2.6'
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile "com.android.support:support-v4:${supportLibVersion}"
compile "com.android.support:appcompat-v7:${supportLibVersion}"
compile "com.google.android.gms:play-services-maps:${playServicesVersion}"
compile 'com.android.databinding:library:1.3.1'
compile 'com.android.databinding:adapters:1.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'org.jsoup:jsoup:1.9.2'
compile 'com.jakewharton.timber:timber:4.5.1'
compile 'com.squareup:seismic:1.0.2'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.google.code.gson:gson:2.4'
compile "com.android.support:recyclerview-v7:${supportLibVersion}"
compile 'javax.inject:javax.inject:1#jar'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
// Unit testing dependencies
testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.10.19'
// Set this dependency if you want to use the Hamcrest matcher library
//androidTestCompile 'org.hamcrest:hamcrest-library:1.3'
// more stuff, e.g., Mockito
testCompile "org.robolectric:robolectric:3.3"
}
Today I've solved the same problem! I've spent more than a week trying to find a solution.
In short Lint-plugin for Gradle implicitly supposes that you have the following section
buildscript {
repositories {
jcenter()
google()
}
dependencies {
classpath "com.android.tools.build:gradle:$gradlePluginVersion"
}
}
in your root-level build.gradle file. Just move that common section from your scripts right to the root-level script.
Just add the compileClasspath as a configuration name to your build.gradle
configurations {
compileClasspath
}
buildscript {
repositories {
...
}
dependencies {
...
}
}
My gradle is like bellow :
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "xx.xx.xx"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled true
}
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
testCompile 'junit:junit:4.12'
//Slider
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
//Rx
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
// Web Libs
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
}
And here :
// 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'
//Slider
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
// 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
}
But when I run my project say me BUILD FAILED and show me bellow message :
Remove jackOption from defaultConfig in build.gradle
Add following lines in Application gradle
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'me.tatarka:gradle-retrolambda:3.2.3'
}
And add following line in build.gradle as below:
apply plugin: 'me.tatarka.retrolambda'
Hope this will help.
I resolved my problem :
Module gradle :
apply plugin: 'com.android.application'
apply plugin: 'me.tatarka.retrolambda'
android {
compileSdkVersion 25
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "xx.xxx.xxx"
minSdkVersion 17
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dataBinding {
enabled = true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
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'
})
compile 'com.android.support:appcompat-v7:25.3.1'
compile 'com.android.support:recyclerview-v7:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
testCompile 'junit:junit:4.12'
//Slider
compile 'com.squareup.picasso:picasso:2.3.2'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5#aar'
// Web Libs
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.okhttp3:okhttp:3.6.0'
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-gson:2.1.0'
//Rx
compile 'io.reactivex.rxjava2:rxjava:2.0.1'
compile 'io.reactivex.rxjava2:rxandroid:2.0.1'
compile 'com.jakewharton.retrofit:retrofit2-rxjava2-adapter:1.0.0'
compile 'com.netflix.rxjava:rxjava-android:0.16.1'
}
project gradle :
// 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'
//Slider
classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.10.+'
//Lambda
classpath 'me.tatarka:gradle-retrolambda:3.2.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
}
I recently had a lot of problems trying to debug in my application when using Retrolambda, because of that I wanted to include Jack on my Gradle for debugging purposes.
jackOptions {
enabled true
}
Because of that, I have been going through this error and I still without finding a way to solve it.
Jackson : NoSuchMethodError for com.google.common.base.Preconditions.checkState
I have check different posts looking for a solution:
Android Studio: Gradle - build fails -- Execution failed for task ':dexDebug'
Lambda expressions crash with IncompatibleClassChangeError in Android when using jack
A larger heap for the Gradle daemon is recommended for running jack
But none of the solutions have fixed my problems. Right now my Gradle looks like:
buildscript {
ext {
use_jack = true
dagger_version = "2.8"
firebase_version = "9.6.1"
rx_version = "2.0.3"
rx_firebase_version = "1.0.0"
rx_android_version = "2.0.1"
gson_version = "2.8.0"
butterkinfe_version = "8.4.0"
support_version = "25.0.0"
target_sdk_version = 24
}
}
apply plugin: 'com.android.application'
if (!use_jack) { //Backport to apt / RetroLambda
apply plugin: 'me.tatarka.retrolambda'
apply plugin: 'com.neenbedankt.android-apt'
}
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.myaplicattion"
minSdkVersion 15
targetSdkVersion project.properties.target_sdk_version
versionCode 1
versionName "0.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
jackOptions {
enabled use_jack
}
}
buildTypes {
debug {
minifyEnabled false
testCoverageEnabled = true
}
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
//Support
compile "com.android.support:appcompat-v7:$support_version"
compile "com.android.support:design:$support_version"
//Util
compile 'com.intellij:annotations:12.0'
compile 'com.jakewharton.timber:timber:4.3.1'
compile "com.jakewharton:butterknife:$butterkinfe_version"
if (use_jack) annotationProcessor "com.jakewharton:butterknife-compiler:$butterkinfe_version"
else apt "com.jakewharton:butterknife-compiler:$butterkinfe_version"
compile 'com.github.mukeshsolanki:country-picker-android:1.1.6'
compile 'com.theartofdev.edmodo:android-image-cropper:2.3.+'
//Glide
compile 'com.github.bumptech.glide:glide:3.7.0'
//Firebase
// compile "com.firebaseui:firebase-ui-database:0.4.0"
compile "com.google.firebase:firebase-storage:$firebase_version"
compile "com.google.firebase:firebase-messaging:$firebase_version"
compile "com.google.firebase:firebase-common:$firebase_version"
compile "com.google.firebase:firebase-auth:$firebase_version"
compile "com.google.firebase:firebase-core:$firebase_version"
compile "com.google.firebase:firebase-database:$firebase_version"
compile "com.google.firebase:firebase-crash:$firebase_version"
compile "com.github.frangsierra:rx2firebase:$rx_firebase_version"
//GSON
compile "com.google.code.gson:gson:$gson_version"
//Facebook
compile 'com.facebook.android:facebook-android-sdk:[4,5)'
//Dagger
compile "com.google.dagger:dagger:$dagger_version"
if (use_jack) annotationProcessor "com.google.dagger:dagger-compiler:$dagger_version"
else apt "com.google.dagger:dagger-compiler:$dagger_version"
//Rx
compile "io.reactivex.rxjava2:rxjava:$rx_version"
compile "io.reactivex.rxjava2:rxandroid:$rx_android_version"
//Test
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'
})
testCompile 'junit:junit:4.12'
compile 'com.android.support.test:runner:0.5'
}
apply plugin: 'com.google.gms.google-services'
And my appgradle :
// 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.2.3'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'me.tatarka:gradle-retrolambda:3.2.5'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
mavenLocal()
maven { url "https://jitpack.io" }
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
I'm getting an error in Android Studio 1.5.1 and I can't figure it out for the life of me. It reads,
"Error:Execution failed for task ':app:dexguardDebug'.
No such property: bootClasspath for class: com.android.builder.core.AndroidBuilder"
When running ./gradle2 debugCompile --stacktrace from the command line, it shows this:
What went wrong:
Task 'compileDebug' is ambiguous in root project 'BestWestern'.
Candidates are: 'compileDebugAidl', 'compileDebugAndroidTestAidl',
'compileDebugAndroidTestJavaWithJavac', 'compileDebugAndroidTestNdk',
'compileDebugAndroidTestRenderscript',
'compileDebugAndroidTestSources', 'compileDebugJavaWithJavac',
'compileDebugNdk', 'compileDebugRenderscript', 'compileDebugSources',
'compileDebugUnitTestJavaWithJavac', 'compileDebugUnitTestSources'.
I'm not exactly sure what to do from this point
Here are my grade files:
//////////////////////
// Module: app
//////////////////////
apply plugin: 'com.android.application'
apply plugin: 'dexguard'
android {
compileSdkVersion 23
buildToolsVersion "23.0.1"
defaultConfig {
applicationId "com.bestwestern.android"
minSdkVersion 14
targetSdkVersion 23
versionCode 143
versionName "5.5"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
/*release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
debuggable true
}*/
debug {
proguardFile getDefaultDexGuardFile('dexguard-debug.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
release {
proguardFile getDefaultDexGuardFile('dexguard-release.pro')
proguardFile 'dexguard-project.txt'
proguardFile 'proguard-project.txt'
}
}
packagingOptions {
exclude 'LICENSE.txt'
}
/*productFlavors {
}*/
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
flatDir {
dirs 'libs'
}
}
dependencies {
//compile 'com.android.support:multidex:1.0.1'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.0.1'
compile 'com.android.support:cardview-v7:23.0.1'
compile 'com.google.android.gms:play-services-location:7.0.0'
compile project(':androidtimessquare')
compile 'com.squareup.retrofit:retrofit:1.9.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.okhttp:okhttp:2.2.0'
//compile 'com.squareup.picasso:picasso:2.+'
compile 'com.android.support:recyclerview-v7:23.0.1'
compile 'de.hdodenhof:circleimageview:1.2.2'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'de.greenrobot:eventbus:2.4.0'
//compile(name: 'masterpass-android-library-release', ext: 'aar')
// AndroidJUnit Runner dependencies
androidTestCompile 'com.android.support:support-annotations:23.0.1'
androidTestCompile 'com.android.support.test:runner:0.2'
androidTestCompile 'com.android.support.test:rules:0.2'
// Espresso dependencies
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
compile files('libs/adobeMobileLibrary-4.6.1.jar')
compile 'com.facebook.android:facebook-android-sdk:4.1.0'
//compile 'org.twitter4j:twitter4j-core:4.0.2'
compile('com.twitter.sdk.android:tweet-composer:0.8.0#aar') {
transitive = true;
}
compile 'com.github.bumptech.glide:glide:3.6.+'
compile 'com.readystatesoftware.sqliteasset:sqliteassethelper:+'
compile project(':googlemapssdkm4b_lib')
compile files('libs/RootShell.jar')
//compile files('libs/dexguard-util.jar')
}
//////////////////////
// Project:
//////////////////////
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
mavenCentral()
flatDir dirs: 'lib'
}
dependencies {
/*classpath ('com.android.tools.build:gradle:1.0.0') {
exclude module: 'proguard-gradle'
}
classpath "jp.leafytree.gradle:gradle-android-scala-plugin:1.3.1"
classpath ('net.sf.proguard:proguard-gradle:5.0') {
force = true
}*/
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.android.tools.build:gradle:1.5.0'
classpath ':dexguard:'
}
}
allprojects {
repositories {
maven { url 'http://repo1.maven.org/maven2' }
}
}
This will be most likely caused incompatible versions of Android Gradle Plugin and DexGuard library. Try to downgrade a version of Android Gradle Plugin to 1.3.1.
Could I ask which version of DexGuard are you using?