Error:No such property: defaultConfig for class: java.lang.String - java

Error:No such property: defaultConfig for class: java.lang.String
I am getting this error as soon as i sync my project but the same project is working fine in other people's computer.
i can not find the problem please help me fix this.
here is the build.gradle
apply plugin: 'com.android.application'
android {
android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)
dexOptions {
javaMaxHeapSize "4g"
preDexLibraries false
}
compileSdkVersion 26
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.Aven.andromedia"
minSdkVersion 15
targetSdkVersion 26
versionCode 3
versionName "1.0"
testInstrumentationRunner"android.support.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
multiDexEnabled true
vectorDrawables {
useSupportLibrary = true
}
}
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:26.1.0'
compile 'com.android.support:design:26.1.0'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'com.android.support.constraint:constraint-layout:1.0.2'
compile 'com.aurelhubert:ahbottomnavigation:2.1.0'
compile 'com.android.support:support-vector-drawable:26.1.0'
compile 'devlight.io:navigationtabbar:1.2.5'
compile 'com.android.support:support-v4:26.3.1'
compile 'com.leo.simplearcloader:simplearcloader:1.0.+'
compile 'com.github.jd-alexander:LikeButton:0.2.3'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.7.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2'
compile 'com.jakewharton.timber:timber:3.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.2.0'
compile 'com.google.android.gms:play-services-auth:11.8.0'
compile 'com.google.firebase:firebase-core:11.8.0'
compile 'com.google.firebase:firebase-messaging:11.8.0'
compile 'com.google.firebase:firebase-ads:11.8.0'
compile 'com.github.vivchar:ViewPagerIndicator:v1.0.1'
compile 'com.github.GrenderG:Toasty:1.2.5'
compile 'com.anjlab.android.iab.v3:library:1.0.44'
compile 'com.yayandroid:ParallaxRecyclerView:1.1'
compile 'com.facebook.android:facebook-android-sdk:4.29.0'
compile 'pl.bclogic:pulsator4droid:1.0.3'
compile 'com.jaredrummler:animated-svg-view:1.0.5'
compile 'com.miguelcatalan:materialsearchview:1.4.0'
testCompile 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'

May I ask which gradle version you are running?
If the error occured after updating to gradle 3.0 you might wanna check out the Gradle 3.0 migration guide for help.

You should remove line android.defaultConfig.vectorDrawables.setUseSupportLibrary(true)

Related

Error:Execution failed for task app:transformClassesWithMultidexlistForDebug'

I added a few dependencies in my project and when I run it this error shows:
Error:Execution failed for task ':app:transformClassesWithMultidexlistForDebug'. > java.io.IOException: Can't write [D:\android\projects\android-client\app\build\intermediates\multi-dex\debug\componentClasses.jar] (Can't read [D:\android\projects\android-client\app\build\intermediates\transforms\desugar\debug\47.jar(;;;;;;**.class)] (Duplicate zip entry [47.jar:android/support/design/widget/CoordinatorLayout$Behavior.class]))
and here is my build.gradle file:
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.arizeh.arizeh"
minSdkVersion 17
targetSdkVersion 22
multiDexEnabled true
versionCode 31
versionName "3.0.5"
useLibrary 'org.apache.http.legacy'
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
manifestPlaceholders = [manifestApplicationId : "",
onesignal_app_id : "",
onesignal_google_project_number: ""]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
}
}
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:26.0.0-beta1'
compile 'com.google.android.gms:play-services-plus:15.0.1'
compile 'com.google.android.gms:play-services-analytics:15.0.2'
compile 'com.google.android.gms:play-services-nearby:15.0.1'
compile 'com.google.android.gms:play-services-maps:15.0.1'
compile 'com.google.android.gms:play-services-places:15.0.1'
compile 'com.google.android.gms:play-services-location:15.0.1'
compile 'com.google.android.gms:play-services-gcm:15.0.1'
compile 'com.google.android.gms:play-services-base:15.0.1'
compile 'com.google.firebase:firebase-messaging:15.0.2'
testCompile 'junit:junit:4.12'
compile 'com.android.support:design:26.1.0'
compile 'com.android.support:cardview-v7:26.1.0'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.google.code.gson:gson:2.8.0'
compile 'com.koushikdutta.ion:ion:2.+'
compile 'com.android.support:percent:26.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.shawnlin:number-picker:2.4.2'
compile 'com.astuetz:pagerslidingtabstrip:1.0.1'
compile 'com.android.support:multidex:1.0.3'
compile 'com.android.support:support-compat:26.1.0'
compile 'com.daimajia.easing:library:2.0#aar'
compile 'com.daimajia.androidanimations:library:2.2#aar'
compile 'com.zarinpal:purchase:0.0.3-beta'
compile 'com.squareup.retrofit2:retrofit:2.3.0'
compile 'com.squareup.retrofit2:converter-gson:2.3.0'
compile "com.android.support:support-core-ui:26.4.0"
implementation 'com.rahnema.vas3gapi:vas3g-api:2.0.0'
}
apply plugin: 'com.google.gms.google-services'
You need to use the same version of support library. In your dependencies block, you adding multiple version of support libraries:
compile 'com.android.support:appcompat-v7:26.0.0-beta1'
compile 'com.android.support:design:26.1.0'
compile "com.android.support:support-core-ui:26.4.0"
use only one version either 26.1.0 or 26.4.0. Don't use beta version.
I think you have not added the dependency.
dependencies {
compile 'com.android.support:multidex:1.0.3'
}
please add it and rebuild the project.I hope it will be work

gradle file error when i changed recyclerview version from 23.0.1 to 23.2.1

apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "adhoc.mlm_app"
minSdkVersion 15
targetSdkVersion 23
versionCode 4
versionName "1.0.4"
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.constraint:constraint-layout:1.0.2'//getting error
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.0.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
testCompile 'junit:junit:4.12'
}
All com.android.support libraries must use the exact same version
specification (mixing versions can lead to runtime crashes). Found
versions 23.2.1, 23.0.1. Examples include
com.android.support:animated-vector-drawable:23.2.1 and
com.android.support:design:23.0.1 )
Use
compile `'com.android.support:design:23.2.1'`
instead of
compile 'com.android.support:design:23.0.1'
update gradle file with below code
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.constraint:constraint-layout:1.0.2'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'//change here
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.android.support:cardview-v7:23.2.1'
compile 'com.android.support:recyclerview-v7:23.2.1'
testCompile 'junit:junit:4.12'
}

I am getting java.lang.NoClassDefFoundError: org.jxmpp.util.cache.LruCache exception in my project

I am getting NoClassDefFoundError exception at below line,
XMPPconfig = XMPPTCPConnectionConfiguration.builder();
And I have searched in many site but did't get solution for it. So please help me to resolve this issue. Below I am attaching debug snaps.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.xyz.myapp_alpha"
minSdkVersion 15
targetSdkVersion 23
versionCode 21
versionName "1.79.1004"
// Enabling multidex support.
multiDexEnabled true
}
dexOptions {
preDexLibraries = false
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'),'proguard-rules.pro'
}
}}
repositories {
mavenCentral()
maven {
url "http://dl.bintray.com/journeyapps/maven"
}}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.2.1'
compile 'com.android.support:design:23.2.1'
compile 'com.android.support:cardview-v7:23.1.1'
compile 'com.getbase:floatingactionbutton:1.10.1'
compile 'de.hdodenhof:circleimageview:2.0.0'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.nostra13.universalimageloader:universal-image-loader:1.9.5'
compile project(':weekcalendar')
compile 'com.github.johnkil.print:print:1.2.2'
compile project(':MPChartLib')
compile 'com.amulyakhare:com.amulyakhare.textdrawable:1.0.1'
compile project(':library')
compile 'com.github.sundeepk:compact-calendar-view:1.7.8'
compile 'com.jakewharton:butterknife:7.0.0'
compile project(':agendacalendarview')
compile 'com.google.android.gms:play-services-location:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile project(':xCLCharts')
compile 'com.journeyapps:zxing-android-embedded:2.0.1#aar'
compile 'com.journeyapps:zxing-android-legacy:2.0.1#aar'
compile 'com.journeyapps:zxing-android-integration:2.0.1#aar'
compile 'com.google.zxing:core:3.0.1'
compile 'org.jsoup:jsoup:1.7.3'
compile project(':qreader')
compile project(':cropper')
compile 'org.igniterealtime.smack:smack-android-extensions:4.1.9'
compile 'org.igniterealtime.smack:smack-android:4.1.9'
compile 'org.igniterealtime.smack:smack-tcp:4.1.9'
// compile 'com.android.support:multidex:1.0.0'
//compile 'org.igniterealtime.smack:smack-resolver-javax:4.1.9'
// compile group: 'org.jxmpp', name: 'jxmpp-util-cache', version: '0.4.1'}

Deploying signed apk from android studio to device

I am trying to deploy signed apk from android studio. I have configured the build.gradle with required credentials but I've got some warnings when I try to build the .apk. I tried adding some commands in proguard rules but still I get same warnings. How can I fix this issue?
Here are the pictures of the issue.
And this is the gradles file.
apply plugin: 'com.android.application'
apply plugin: 'android-apt'
apply plugin: 'com.neenbedankt.android-apt'
//apply plugin: 'com.google.gms.google-services'
android {
signingConfigs {
release {
keyAlias 'something'
keyPassword 'something'
storeFile file('D:/something')
storePassword 'something'
}
}
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.aam.skillschool"
minSdkVersion 19
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.release
}
}
configurations.all {
resolutionStrategy.force 'com.google.code.findbugs:jsr305:1.3.9'
}
}
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.google.apis:google-api-services-youtube:v3-rev179-1.22.0'
compile 'com.android.support:appcompat-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.jakewharton:butterknife:8.4.0'
compile 'com.android.volley:volley:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:4.+'
compile 'com.jakewharton.timber:timber:4.3.1'
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.android.support:design:25.0.0'
compile 'com.google.code.gson:gson:2.8.0'
testCompile 'junit:junit:4.12'
testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
apt 'com.jakewharton:butterknife-compiler:8.4.0'
debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'
releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
apt 'com.google.dagger:dagger-compiler:2.7'
compile 'com.google.dagger:dagger:2.7'
provided 'javax.annotation:jsr250-api:1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'de.hdodenhof:circleimageview:2.1.0'
compile 'br.com.mauker.materialsearchview:materialsearchview:1.2.0'
compile 'com.google.http-client:google-http-client-android:+'
compile 'com.google.api-client:google-api-client-android:+'
compile 'com.google.api-client:google-api-client-gson:+'
}
Thanks in advance!
you have the non-use classes of your imported libraries already deleted by proguard, revert back to the version where u had no pro-guard applied,that version should work.Then carefully include all your exceptions and rules of all your libraries in your pro-guard rules and then try to use the proguard

Error:Execution failed for task ':app:dexDebug'. > com.android.ide.common.process.ProcessException:

I am getting below error. How can I resolve this? There were questions asked regarding this, But that didn't worked for me.
Error:Execution failed for task ':app:dexDebug'.
com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-openjdk-amd64/bin/java'' finished with non-zero exit value 2
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mukesh.airpollution"
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'
}
dependencies {
compile 'com.loopj.android:android-async-http:1.4.4'
}
dependencies {
compile 'com.google.code.gson:gson:2.2.4'
}
dependencies {
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.parse.bolts:bolts-android:1.+'
compile 'org.jsoup:jsoup:1.7.3'
}
dependencies {
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
dependencies {
compile 'com.android.support:recyclerview-v7:23.0.+'
}
dependencies {
compile 'com.android.support:design:23.1.1'
}
You have
compile 'com.google.android.gms:play-services:8.3.0'
and
compile 'com.google.android.gms:play-services:8.4.0'
try removing one of them
Change your build.gradle code to below code.
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.example.mukesh.airpollution"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.1.1'
compile files('libs/jsoup-1.8.3.jar')
}
dependencies {
compile group: 'cz.msebera.android' , name: 'httpclient', version: '4.4.1.1'
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.google.android.gms:play-services:8.3.0'
compile 'com.google.maps.android:android-maps-utils:0.4+'
compile 'com.android.support:recyclerview-v7:23.1.1'
compile 'com.loopj.android:android-async-http:1.4.4'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.android.support:design:23.1.1'
}

Categories