Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Error while merging dex archive in Android Studio

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I'm making an QR code Scanner using ZXing in my library. I'm getting this error while trying to to run this program in my phone via app debugging:

  • AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat","sources":[{}],"tool":"D8"}
  • :app:transformDexArchiveWithExternalLibsDexMergerForDebug FAILED
  • Execution failed for task ':app:transformDexArchiveWithExternalLibsDexMergerForDebug'.> com.android.builder.dexing.DexArchiveMergerException: Error while merging dex archives


  • here is my app build:gradle :



    and this is my main_activity :

    package com.example.toshiba.myekantin;



    I'm using :
    Android Studio 3.1.3
    API 22

    What have i try to get rid the error :
  • clean project and rebuild project
  • adding this to my main activity program





  •  
    Bartender
    Posts: 1868
    81
    Android IntelliJ IDE MySQL Database Chrome Java
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    I do have a couple of thoughts which may help.
  • Some postings suggest that this problem can be related to outdated libraries.
       - Do you know if you have the more recent SDK and recent versions of all of the libraries that your app wants?
  • What if you try an different (newer or older) version of Gradle?
  • What if you try an older version of Android Studio?
  • Some postings suggest that this problem is related to certain libraries.
       - Are you able to create a slimmed down version of your app with only the Barcode library?
  • Does changing the SDK versions either compile, min or target give you different results?
  • A posting or two suggest that the cause shown in this line
       AGPBI: {"kind":"error","text":"Program type already present: android.support.v4.accessibilityservice.AccessibilityServiceInfoCompat","sources":[{}],"tool":"D8"}.
       Or more precisely with the android.support.v4 library. If you change to different (older or newer) of that library do you get different results?
  • You appear to be using an "alpha" version of a library, this could be an issue
  •  
    nida azizah
    Ranch Hand
    Posts: 31
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    hi. Thanks for your suggestion. The problem was solved by changing my library because my library isn't suitable.
    reply
      Bookmark Topic Watch Topic
    • New Topic