Please can anyone help me in my issue I got this exception but I don't know why and I can't fix it
Execution failed for task ':app:multiDexListDebug'.
A failure occurred while executing
com.android.build.gradle.internal.tasks.Workers$ActionFacade Error
while merging dex archives: Learn how to resolve the issue at
https://developer.android.com/studio/build/dependencies#duplicate_classes.
Program type already present: com.share.albir.MainActivity
defaultConfig {
applicationId "com.share.albir"
minSdkVersion 23
targetSdkVersion 30
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
multiDexEnabled true
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation project(path: ':oppwa.mobile')
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:customtabs:28.0.0'
implementation 'com.google.android.gms:play-services-wallet:16.0.1'
}
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
android.enableR8=true
android.enableDexingArtifactTransform=false
org.gradle.parallel=false
Note that : I'm not used firebase in my app and this solution not working for me
enter link description here
Try the following step:
1. File-> Invalidate Cache -> Invalidate & Restart
2.Go to android/app/build.gradle and add the following lines of codes:
dependencies {
implementation 'com.android.support:multidex:2.0.1' //enter the latest multidex version
}
android {
defaultConfig {
multiDexEnabled true
}
}
3.flutter upgrade
Thank you,
The issue was gone when I put this two lines
minifyEnabled false
shrinkResources false
Related
So I am assuming I have differing versions of dependencies causing this issue but i cant seem to resolve it.
When I add the dependency: implementation 'com.google.android.gms:play-services-vision:18.0.0' Then I get an error Syncing my build gradle.
When I change the version to implementation 'com.google.android.gms:play-services-vision:15.0.0' Then It Syncs fine but my app keeps crashing as soon as I open it.
Please can someone help me sync my versions so my app doesnt crash.
I changed the version from 18.0.0 to 15.0.0.
My gradle:
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.ecommerce"
minSdkVersion 15
targetSdkVersion 28
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.google.firebase:firebase-core:11.8.0'
implementation 'com.google.firebase:firebase-database:11.8.0'
implementation 'com.google.firebase:firebase-storage:11.8.0'
implementation 'com.firebaseui:firebase-ui-database:3.2.2'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.github.rey5137:material:1.2.5'
implementation 'com.android.support:cardview-v7:+'
implementation 'com.android.support:recyclerview-v7:+'
implementation 'io.paperdb:paperdb:2.6'
implementation 'com.android.support:design:28.0.0'
implementation 'de.hdodenhof:circleimageview:3.0.0'
implementation 'com.google.android.gms:play-services-vision:18.0.0'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.sup`enter code here`port.test.espresso:espresso-core:3.0.2'
}
After some research I actually found out that Google stopped updating com.google.android.gms:play-services after 12.0.1. I changed the versions as well as my Firebase versions. Everthing Synced with no errors and seems to be running fine now.
first go to file and sync project with gradle file.. if it repeat itself, then go to file and invalidate caches/Restart it has work for me alot of time and also try and replace minSdkVersion 15 to minSdkVersion 21 and also with the look of it your firebase dependence are old check out https://firebase.google.com/docs/android/setup or google firebase dependencies
also make sure you add allprojects
{
repositories {
jcenter()
maven {
url "https://maven.google.com"
}
}
}
to your build.gradle
i back to work again to complete my application but when the application start syncing it gave me
Failed to resolve: androidx Affected Modules: href="openFile:D:/.android/Step View/Application/Source Code/app/build.gradle">app
I see a question like this but it didn't works for me. sorry for my bad english.
this is my gradle. app
buildscript {
repositories {
maven { url 'https://plugins.gradle.org/m2/' }
}
dependencies {
classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.11.0, 0.99.99]'
}
}
apply plugin: 'com.onesignal.androidsdk.onesignal-gradle-plugin'
repositories {
maven {
url 'https://maven.google.com'
}
}
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "com.xcoder.stepview"
minSdkVersion 17
targetSdkVersion 28
multiDexEnabled true
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.connection_light.runner.AndroidJUnitRunner"
manifestPlaceholders = [
onesignal_app_id : '6a2c7692-81ec-4d12-b973-6b78f71f380e',
// Project number pulled from dashboard, local value is ignored.
onesignal_google_project_number: 'REMOTE'
]
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildToolsVersion '28.0.3'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
implementation 'com.google.firebase:firebase-core:16.0.6'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.github.kittinunf.fuel:fuel-android:1.12.1'
implementation 'com.google.firebase:firebase-ads:17.1.2'
implementation 'com.github.bassaer:chatmessageview:1.10.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha3'
implementation 'com.github.markushi:circlebutton:1.1'
implementation 'com.google.android.material:material:1.1.0-alpha02'
implementation 'com.google.firebase:firebase-database:16.0.5'
implementation 'com.github.ybq:Android-SpinKit:1.2.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'commons-io:commons-io:2.5'
implementation 'androidx.percentlayout:percentlayout:1.0.0'
implementation 'com.onesignal:OneSignal:[3.9.1, 3.99.99]'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.connection_light:runner:1.1.1'
androidTestImplementation 'androidx.connection_light.espresso:espresso-core:3.1.1'
}
apply plugin: 'com.google.gms.google-services'
In my case it was caused by a typo in build.gradle:
//androidTestImplementation 'androidx .test.espresso:espresso-core:3.2.0' // wrong!
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
I found the error by running the Gradle wrapper from the command line with the stacktrace option:
./gradlew clean build --stacktrace
Output:
Caused by: org.gradle.internal.resolve.ModuleVersionNotFoundException:
Could not find androidx. test.espresso:espresso-core:3.2.0.
Try to update all com.android* to the available com.androidx* versions that you can.
Make sure you have...
android.enableJetifier=true
android.useAndroidX=true
Added to your gradle.properties.
Or you could just do
With Android Studio 3.2 and higher, you can quickly migrate an existing project
to use AndroidX by selecting Refactor > Migrate to AndroidX from the menu bar.
https://developer.android.com/jetpack/androidx/migrate
You are using both support library and androidx library in one project, that's the issue.
Change the support libraries to the preferred AndroidX library.
and also you can Migrate to AndroidX from Android Studio itself
Simply go to Refactor > Migrate to AndroidX > Migrate
add below code in gradle.properties file
android.enableJetifier=true
android.useAndroidX=true
more info for migration check this
for me it was
implementation 'androidx.appcompat:appcompat:1.1.0'
which must be
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
that means check versions and implement the last ones for each androidx you have.
you most upgrade all base library
change it
implementation 'androidx.appcompat:appcompat:1.1.0-alpha01'
to
implementation 'androidx.appcompat:appcompat:1.+'
and
androidTestImplementation 'androidx.connection_light:runner:1.1.1'
to
androidTestImplementation 'androidx.test:runner:1.+'
and
androidTestImplementation 'androidx.connection_light.espresso:espresso-core:3.1.1'
to
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
Ever since the update, I keep getting the following error when I build. I have tried clean and build but the error persists:
This is the error I get when I try to build:
Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
The problem seems to be related to an issue with xmlbeans-2.6.0.jar, however I don't really understand what's it trying to do by "dexingTransform". Do I need to add anything to my gradle to support my project after the update?
This is my build.grade:
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
defaultConfig {
applicationId "app.testApp"
minSdkVersion 26
targetSdkVersion 28
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:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:multidex:1.0.3'
implementation "org.apache.poi:poi:3.17"
implementation "org.apache.poi:poi-ooxml:3.17"
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.android.support:design:28.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.5.1'
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'
}
and the following reported errors that I cannot understand, which are coming up after the update:
org.gradle.initialization.ReportedException: org.gradle.internal.exceptions.LocationAwareException: Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
Caused by: org.gradle.api.artifacts.transform.ArtifactTransformException: Failed to transform file 'xmlbeans-2.6.0.jar' to match attributes {artifactType=android-dex, dexing-is-debuggable=true, dexing-min-sdk=26} using transform DexingTransform
Caused by: com.android.tools.r8.utils.AbortException: Error: Program type already present: org.apache.xmlbeans.xml.stream.Location
Ok, I have figured out what the problem was. Turns out after updating to gradle 4.4, you'll get an error if you have duplicate library references in your project. In my case, this was xmlbeans-2.6.0.jar, and I had the following dependencies clashing with each other:
implementation "org.apache.poi:poi:3.17"
implementation "org.apache.poi:poi-ooxml:3.17"
implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
So in my case I kept the following, and commented out the rest:
//implementation "org.apache.poi:poi:3.17"
//implementation "org.apache.poi:poi-ooxml:3.17"
//implementation 'com.fasterxml:aalto-xml:1.0.0'
implementation 'com.jakewharton:butterknife:8.5.1'
I then re-synced gradle, clean and build the project, and my issue was resolved.
I am trying to build an application in Android and I tried using the FirebaseUI, but I am getting this error:
error: cannot access zzeuq
class file for com.google.android.gms.internal.zzeuq not found
Here is my gradle file.
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "com.example.vanillatalk.vanillatalk"
minSdkVersion 21
targetSdkVersion 27
versionCode 1
versionName "1.0"
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'
compile 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
implementation 'com.google.firebase:firebase-auth:11.6.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'
implementation 'com.google.firebase:firebase-database:11.6.0'
implementation 'com.google.firebase:firebase-storage:11.6.0'
implementation 'de.hdodenhof:circleimageview:2.2.0'
compile 'com.theartofdev.edmodo:android-image-cropper:2.7.+'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
}
apply plugin: 'com.google.gms.google-services'
I think that the error is related to missmatched versions of firebase, since it 11.6.0 and firebase-ui-database:4.0.0, but I cannot seem to find the correct versions for the firebase-ui-database that would match the 11.6.0?
Could anyone help?
If you want to use version 4.0 of firebase ui you need to update firebase dependencies:
implementation 'com.google.firebase:firebase-database:16.0.1'
For version 11.6.0 of firebase you should use version 3.x.x of Firebase UI, see this.
You have to use all latest library dependency to use
implementation 'com.firebaseui:firebase-ui-database:4.0.0'
Now I checked that when I use firebase-database:15.0.1 library it's doesn't let me do syn properly.
Use the latest version of all other library dependency, I'm it will be work.
implementation 'com.google.firebase:firebase-database:16.0.1'
implementation 'com.google.firebase:firebase-auth:16.0.1'
implementation 'com.google.firebase:firebase-storage:16.0.1'
Or you can try to find firebase-database:11.6.0 this version similar FirebaseUi library. But it's hard to found.
Thanks.
Getting the below error at the time of running java program in android studio.
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app (27.1.1) differ. See https://d.android.com/r/tools/test-apk-dependency-conflicts.html for details.
Any solution please. ?
Use implementation 'com.android.support:appcompat-v7:27.1.1'
instead of implementation 'com.android.support:appcompat-v7:26.1.0' and change compileSdkVersion 26 to 27
thanks to #Ganesh Bhat and Chad Bingham
For those who still facing the problem, above answer did not help me in android studio 2.2 Preview.
This fixed my issue.
add this to your gradle file.
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:23.1.1'
}
}
Reference:
https://github.com/JakeWharton/u2020/blob/05a57bf43b9b61f16d32cbe8717af77cd608b0fb/build.gradle#L136-L140
Android support library error after updating to 23.3.0
Resolved versions for app (22.0.0) and test app (21.0.3) differ
update
- if the previous answer doesn't work :
you should update the compileSdkVersion and appcompat to the latest update till now compileSdkVersion is 27 ,
also appcompat is 27.1.1 and 28.0.0-alpha1 is a pre-release version
thus
change
compileSdkVersion 27
and
implementation 'com.android.support:appcompat-v7:26.1.0'
to latest update
implementation 'com.android.support:appcompat-v7:27.1.1'
you can check the latest updates from this link :
https://developer.android.com/topic/libraries/support-library/revisions
I answered before some minutes same question Reference. If you are not going to implement testing code, then remove junit from your app.
There are lot of other questions related to this.
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.3.0) and test app (23.1.1) differ
Conflict with dependency 'com.android.support:support-annotations'. Resolved versions for app (23.1.0) and test app (23.0.1) differ
Add this to your app gradle file
configurations.all {
resolutionStrategy {
force 'com.android.support:support-annotations:26.1.0'
}
}
Add these lines within your app dependencies braces,
android{
configurations.all {
resolutionStrategy.force 'com.android.support:support-annotations:27.1.1'
}
}
Latest is 27.1.1 upto this date.
AS configuration version:
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.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'**
Modify:
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:26.0.0-beta1'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.android.support:design:26.0.0-beta1'
testImplementation 'junit:junit:4.12'
**androidTestImplementation 'com.android.support.test:runner:1.0.1'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'**
Well, I too faced the same problem here is how I fixed it
Goto app level Gradle file
There you will find what are all the config's you have set up. In my case here
android{
**compileSdkVersion 26**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 26**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:26.1.0'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
So here just change the compileSdkVersion & targetSdkVersion from 26 to 27
and
from dependencies change support appcomat
from implementation 'com.android.support:appcompat-v7:26.1.0'
to implementation 'com.android.support:appcompat-v7:27.1.1'
android {
**compileSdkVersion 27**
defaultConfig {
applicationId "com.xxxxxxxxxxx.yyyyyyyy.zzz"
minSdkVersion 19
**targetSdkVersion 27**
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
**implementation 'com.android.support:appcompat-v7:27.1.1'**
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
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'
}
Got Fixed !!!
Hello guys I had the same problem for solving this problem u need to change you appcompat in your app bulid gradle to
implementation 'com.android.support:appcompat-v7:27.1.1'
then it should ask you to instal it if u have'nt installed if still errore didnt solved change your sdkversions it will help alot because if u change the appcompact
to 27.1.1 u need to change your sdkversion to 27 as well i suggest all of u to update your android studio and the sdk to the lastest
Try below change if it helps you
com.android.support:appcompat-v7:26.1.0
to
com.android.support:appcompat-v7:27.1.1
Error:
Error:Execution failed for task ':app:preDebugAndroidTestBuild'.
Conflict with dependency 'com.android.support:support-annotations' in project ':app'. Resolved versions for app (26.1.0) and test app
(27.1.1) differ. See
https://d.android.com/r/tools/test-apk-dependency-conflicts.html for
details.
This is due to there is no dependency added to your App build.gradle or might be its an old version. So, add a dependency for annotation support.
implementation 'com.android.support:support-annotations:27.1.1'
Here I have added annotation version 27.1.1 to solve your error if this is mismatched with different version then change it to the required version.
I found this very easy.
We will use update and use same version for all modules.
1. Go to project level build.gradle, use global variables
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlinVersion = '1.2.61'
ext.global_minSdkVersion = 16
ext.global_targetSdkVersion = 28
ext.global_buildToolsVersion = '28.0.1'
ext.global_supportLibVersion = '27.1.1'
}
2. Go to app level build.gradle, and use global variables
app level build.gradle
android {
compileSdkVersion global_targetSdkVersion
buildToolsVersion global_buildToolsVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_targetSdkVersion
}
...
dependencies {
implementation "com.android.support:appcompat-v7:$global_supportLibVersion"
implementation "com.android.support:recyclerview-v7:$global_supportLibVersion"
// and so on...
}
some library/module build.gradle
android {
compileSdkVersion global_targetSdkVersion
buildToolsVersion global_buildToolsVersion
defaultConfig {
minSdkVersion global_minSdkVersion
targetSdkVersion global_targetSdkVersion
}
...
dependencies {
implementation "com.android.support:appcompat-v7:$global_supportLibVersion"
implementation "com.android.support:recyclerview-v7:$global_supportLibVersion"
// and so on...
}
The solution is to make your versions same as in all modules. So that you don't have conflicts.
Tips for future
I felt when I have updated versions of everything- gradle, sdks,
libraries etc. then I face less errors. Because developers are working
hard to make it easy development on Android Studio.
Always have **latest but stable versions** Unstable versions are alpha, beta and rc, ignore them in developing.
I have updated all below in my projects, and feel flawless coding.
Update Android Studio (Track release)
Project level build.gradle - classpath 'com.android.tools.build:gradle:3.2.0' (Track android.build.gradle release & this)
Have updated buildToolVersion (Track buildToolVersion release)
Have latest compileSdkVersion and targetSdkVersion Track platform release
Have updated library versions, because after above updates, its necessary. (#See How to update)
Happy coding! :)
its important to take a look at this too, in your gradle
targetSdkVersion 27
compileSdkVersion 27
buildToolsVersion '27.0.3'
Go to settings>editor> Then check those two boxes as displayed in the image. It should solve it without any issue.
Add This Code to the bottom of build.gradle at app level. It will work...
configurations.all {
resolutionStrategy.eachDependency{
DependencyResolveDetails details ->
def requested=details.requested
if(requested.group=="com.android.support"){
if(!requested.name.startsWith("multidex")){
details.useVersion("26.0.1")
}
}
}
}