After upgrading to Android Studio 3.4 getting this error - android

I have a project which was made on Android Studio 3.3 and it was working fine without any issues but now when i have upgraded it to Android Studio 3.4 I am getting this compile error.
I have added that Java 1.8 version and all but non of that helped me.
Here is my Build.APP file
apply plugin: 'com.android.application'
apply plugin: 'com.google.gms.google-services'
android {
compileSdkVersion 28
defaultConfig {
applicationId "applicationID"
minSdkVersion 17
targetSdkVersion 28
versionCode 14
multiDexEnabled true
versionName "1.5.1"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
debuggable false
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.google.android.gms:play-services-ads:17.2.0'
implementation 'com.facebook.android:audience-network-sdk:5.1.1'
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-media-compat:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.google.firebase:firebase-messaging:17.6.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.android.exoplayer:exoplayer-core:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-dash:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer-ui:2.9.6'
// implementation 'com.google.android.exoplayer:extension-rtmp:2.8.4'
implementation 'com.google.android.exoplayer:exoplayer-smoothstreaming:2.9.6'
implementation 'com.google.android.exoplayer:exoplayer:2.9.6'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-config:16.5.0'
// Firebase Messages
// Add the In-App Messaging depencency:
implementation 'com.google.firebase:firebase-inappmessaging-display:17.1.1'
// Check that your Firebase dependency is up-to-date:
implementation 'com.android.support:cardview-v7:28.0.0'
implementation files('libs/YouTubeAndroidPlayerApi.jar')
}
apply plugin: 'com.google.gms.google-services'
Here is my Build.Project
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.0'
classpath 'com.google.gms:google-services:4.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
And here are the Error pictures that i am getting when i try to compile it.
Error 1

I just disable the Instant Run from Preferences and now everything is fine 😕

Related

artifacts.ivyservice.DefaultLenientConfiguration$ArtifactResolveException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'

I have working an application without problem in Android Studio 3.2.1 After a long time of absence, I just downloaded Androoid Studio 2021.1 and when I try to run my appli_cation I get this error.
I tried this solution lien but it didn't change anything
I've been looking for a solution for 2 days now. I have already tried all the solutions proposed on StackOverflow and other site but the problem remains the same.
According to the log all my libraries seem to have problems and I don't know why.
Here are my build.gradle files
Project:
buildscript {
ext.kotlin_version = '1.6.21'
repositories {
google()
mavenCentral()
//jcenter()
maven {url 'https://jitpack.io'}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.google.gms:google-services:4.3.10'
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 {
mavenCentral()
google()
//jcenter()
maven {url 'https://jitpack.io'}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Module:
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
android {
compileSdkVersion 31
defaultConfig {
applicationId "cm.logram.lecitoyen"
minSdkVersion 16
versionCode 8
versionName "1.1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
useLibrary 'org.apache.http.legacy'
resConfigs "fr"
multiDexEnabled true
}
buildTypes {
release {
debuggable false
// minifyEnabled true
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
debuggable true
// minifyEnabled true
//shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
//noinspection GradleCompatible
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'androidx.vectordrawable:vectordrawable-animated:1.1.0'
implementation 'androidx.exifinterface:exifinterface:1.3.3'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'com.google.firebase:firebase-analytics:20.1.2'
implementation 'org.apache.commons:commons-text:1.6'
implementation 'com.github.ksoichiro:simplealertdialog:1.2.1#aar'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.7.0-alpha01'
implementation 'androidx.recyclerview:recyclerview:1.3.0-alpha02'
implementation 'androidx.cardview:cardview:1.0.0'
//implementation 'com.chootdev:recycleclick:1.0.0'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation 'com.xeoh.android:text-highlighter:1.0.3'
implementation 'com.androidadvance:topsnackbar:1.1.1'
implementation 'com.crowdfire.cfalertdialog:cfalertdialog:1.1.0'
implementation 'com.google.code.gson:gson:2.8.9'
implementation 'com.wang.avi:library:2.1.3'
implementation 'com.daimajia.androidanimations:library:2.4#aar'
implementation 'com.github.aakira:expandable-layout:1.4.2#aar'
implementation 'com.github.smarteist:autoimageslider:1.3.2-appcompat'
implementation 'com.github.bumptech.glide:glide:4.10.0'
implementation 'com.cjj.persei:library:1.0.0'
implementation 'com.vatsal.imagezoomer:image-zoomer:1.0.2'
implementation 'com.github.medyo:fancybuttons:1.9.1'
implementation 'io.github.kobakei:ratethisapp:1.2.0'
implementation 'com.github.ivbaranov:materiallettericon:0.2.3'
implementation 'com.github.hsmnzaydn:imagezoom:1.2.1'
implementation 'com.github.devendroid:ReadMoreOption:1.0.2'
//Ads
implementation 'com.google.android.gms:play-services-ads:20.6.0'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test:runner:1.4.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0-alpha06'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
apply plugin: 'com.google.gms.google-services'

How to solve: Could not resolve all dependencies for configuration

Hello am facing a problem in android studio
I bought an app source code on codecanyon it's my first to use android studio so im not a developer on Java after import my project getting gradle downloading in the bar below but after finished got this error
Could not resolve all dependencies for configuration ':app:debugRuntimeClasspath'
here is my build.gradle file
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.3'
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and gradle.properties
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1024m
build.gradle inside folder app
apply plugin: 'com.android.application'
android {
compileSdkVersion 30
defaultConfig {
applicationId "com.storeweb.crosswords"
minSdkVersion 19
targetSdkVersion 30
multiDexEnabled true
versionCode 6
versionName "2.3"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
}
buildToolsVersion = '30.0.3'
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "androidx.multidex:multidex:2.0.1"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.browser:browser:1.3.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.google.android.material:material:1.3.0'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
implementation 'androidx.recyclerview:recyclerview:1.2.0'
implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.google.android.gms:play-services-ads:20.1.0'
implementation 'com.google.code.gson:gson:2.8.6'
}

Debug app working but release app not working?

Is there any changes that i want to do in gradle file to work the release app properly. I have recently shifted from normal app to androidx. When i have debug the app and run in my phone it's working properly but when i have installed the release app the it's not working so how to fix it ? When i have move my app to android-x then it has requesting me to change the setShiftingMode(false) to setShifting(false) the problem has been occured due to this or not. How i can fix the above issue ?
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/'}
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.8, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.demo"
manifestPlaceholders = [onesignal_app_id : "fa5f9ac7-sdfdf-dfdf-exampleid-6f",
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: "REMOTE"]
minSdkVersion 19
targetSdkVersion 29
versionCode 5
versionName "5.1.11"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
multiDexEnabled true
}
android {
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
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
buildTypes {
release {
debuggable false
shrinkResources true
minifyEnabled true
useProguard true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
implementation 'com.squareup.okhttp3:okhttp-urlconnection:3.10.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.jakewharton:butterknife:10.0.0'
annotationProcessor 'com.jakewharton:butterknife-compiler:10.0.0'
implementation 'com.github.clans:fab:1.6.4'
implementation 'com.devbrackets.android:exomedia:4.2.1'
implementation 'com.daimajia.numberprogressbar:library:1.4#aar'
debugImplementation 'com.amitshekhar.android:debug-db:1.0.3'
implementation 'com.miguelcatalan:materialsearchview:1.4.0'
implementation project(':library')
implementation('com.github.afollestad.material-dialogs:core:0.8.5.1#aar') {
transitive = true
}
implementation 'org.jsoup:jsoup:1.11.1'
implementation 'com.github.faruktoptas:FancyShowCaseView:1.0.1'
implementation 'com.onesignal:OneSignal:[3.15.0, 3.99.99]'
implementation 'com.google.android.gms:play-services-ads:19.3.0'
implementation 'com.google.firebase:firebase-core:17.4.4'
implementation 'com.loopj.android:android-async-http:1.4.9'
implementation 'io.branch.sdk.android:library:2.+'
implementation project(':jiaozivideoplayer')
}
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'

How to fix " java.lang.NoClassDefFoundError: com/android/tools/r8/com/google/common/collect/ImmutableMultiset" error

After upgrading my android studio and gradle plugin to the latest version, i tried to build my project apk but i got this error "Cause: com/android/tools/r8/com/google/common/collect/ImmutableMultiset", i'm lost and couldn't find anything related to "ImmutableMultiset" on google search. Can anyone help me out Please?
I have tried Invalidate caches, yet not solved..
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://maven.fabric.io/public'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.29.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
and
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
android {
compileSdkVersion 28
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
applicationId "com.talkbiz.naijaexamspreparations"
minSdkVersion 21
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
debuggable false
jniDebuggable false
renderscriptDebuggable false
pseudoLocalesEnabled false
zipAlignEnabled true
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation "com.android.support:support-core-utils:28.0.0"
implementation 'androidx.appcompat:appcompat:1.1.0-rc01'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0-alpha08'
implementation 'com.android.support:design:28.0.0'
implementation 'com.google.firebase:firebase-auth:18.1.0'
implementation 'com.google.firebase:firebase-firestore:20.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.recyclerview:recyclerview:1.1.0-beta01'
implementation 'com.github.antonKozyriatskyi:CircularProgressIndicator:1.3.0'
implementation 'com.maltaisn:calcdialog:1.4.1'
implementation 'com.facebook.android:facebook-login:[5,6)'
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'com.crashlytics.sdk.android:crashlytics:2.10.1'
implementation 'de.psdev.formvalidations:formvalidations:1.2.0'
implementation 'com.firebaseui:firebase-ui-firestore:5.0.0'
implementation 'androidx.paging:paging-runtime:2.1.0'
implementation 'io.supercharge:shimmerlayout:2.1.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'de.hdodenhof:circleimageview:3.0.0'
}
apply plugin: 'com.google.gms.google-services'
I fixed this issue with the below steps:
Go to "C:\Users{username}.gradle\caches" folder
And delete all the files.
Then try

unable to merge dex. Tried everything still not working

I have tried with:
1)Clean and rebuild.
2)multiDexEnabled true.
But still the error shown is:Error:Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.
java.lang.RuntimeException: com.android.builder.dexing.DexArchiveMergerException: Unable to merge dex
Any suggestions how to fix it, please help ?
My app level gradle file:
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
}
}
compileSdkVersion 27
defaultConfig {
applicationId "com.example.hp.facebook_login"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
debug {
}
}
}
repositories {
mavenCentral()
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.facebook.android:account-kit-sdk:4.33.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
My project level gradle file:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
//for Facebook SDK
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Adding these few lines helped remove the error successfully for me :
Here is the new app level gradle file, you can compare and find the changes.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.hp.mkchat"
minSdkVersion 19
targetSdkVersion 27
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'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-core:11.4.2'
implementation 'com.google.firebase:firebase-auth:11.4.2'
implementation 'com.android.support:support-v4:27.1.1-beta1'
implementation 'com.google.firebase:firebase-database:11.4.2'
implementation 'com.google.firebase:firebase-storage:11.4.2'
implementation 'com.google.firebase:firebase-messaging:11.4.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:multidex:1.0.1'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
implementation 'id.zelory:compressor:2.1.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.+'
// ViewModel and LiveData
implementation "android.arch.lifecycle:extensions:1.1.1"
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:0.5'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:2.2.2'
}
apply plugin: 'com.google.gms.google-services'

Categories

Resources