question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android release build error - classes defined multiple times

See original GitHub issue

Your Environment

  • Plugin version: 0.6.3
  • Platform: Android
  • OS version: MacOS 10.14.5
  • React Native version: 0.61.5

When I run ./gradlew bundleRelease, I get this error

Type org.apache.commons.io.Charsets is defined multiple times:  /Users/x/Workspace/Web/x/node_modules/@mauron85/react-native-background- 
 geolocation/android/common/build/.transforms/a8e102993c8c7adae72bf050e6cc7e7e/classes/classes.dex,   
/Users/x/Workspace/Web/x/android/app/build/intermediates/external_libs_dex/release/out/classes2.dex

Here is my android/build.grade file in my react native project

buildscript {
    ext {
        buildToolsVersion = "28.0.3"
        minSdkVersion = 21
        compileSdkVersion = 28
        targetSdkVersion = 28

        googlePlayServicesVersion = "17.0.0"
    }
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath('com.android.tools.build:gradle:3.6.4')
        classpath 'com.google.gms:google-services:4.3.3'

    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {

            url("$rootDir/../node_modules/react-native/android")
        }
        maven {

            url("$rootDir/../node_modules/jsc-android/dist")
        }
        maven { url 'https://maven.google.com'  }

        google()
        jcenter()
        maven { url 'https://jitpack.io' }
    }
}

I’m able to build the app and the gps is working with yarn react-native android for local debug building. But the release build is failing using the command above.

How do I resolve this?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
darron1217commented, Jan 8, 2021

I created fork to solve this issue. https://github.com/darron1217/react-native-background-geolocation

You can install it by command below

npm install https://github.com/darron1217/react-native-background-geolocation#develop
0reactions
Isaachi1commented, Nov 24, 2022

@darron1217 your module not build release using androidX. Your module it is Symbol problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Type BuildConfig is defined multiple times - Stack Overflow
It's the first time I'm seeing an error like this and I don't know how to fix this and what's even causing it....
Read more >
Android Studio generating an error saying “is defined multiple ...
Android Studio generating an error saying “is defined multiple times” ... Just delete the “build” folder of the “app” module.
Read more >
Android R8: Type com.swmansion.reanimated.BuildConfig is ...
We are getting Type com.swmansion.reanimated.BuildConfig is defined multiple times when executing the task :app:minifyReleaseWithR8.
Read more >
D8 mergeProjectDexDebug fails on AS / AGP 4.2.0-alpha12 ...
The error message given from the build is below. ... Open project in Android Studio 4.2 Canary 12 3. ... DataBindingComponent is defined...
Read more >
Gradle tips and recipes - Android Developers
You can use the sourceSets block in the module-level build.gradle file to change ... are only a few examples of the types of...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found