Error while generating main dex list

While trying to start React Native Android

Sat, 12 Jan 2019

If you’re having this issue while trying to compile your Andriod React Native app, try swapping up your build.gradle in your app folder to something like this.

dependencies {
  implementation 'com.android.support:multidex:1.0.3'
  implementation 'com.android.support:design:27.1.0'
}

android {
  compileSdkVersion 27
  defaultConfig {
    minSdkVersion 17
    targetSdkVersion 27
    vectorDrawables.useSupportLibrary = true
    generatedDensities = []
    applicationId = "com.your_app.your_id"
    multiDexEnabled true
  }  
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
  }
  aaptOptions {  
    additionalParameters "--no-version-vectors"  
  }
  project.ext {
    googlePlayServicesVersion = "15.0.0"
  }
  dexOptions {
    javaMaxHeapSize "4g"
  }
}

Specifically you want to pay attention to these two lines

  implementation 'com.android.support:multidex:1.0.3'
  implementation 'com.android.support:design:27.1.0'

After you add these lines to your build.gradle delete your build folder under the app directory

Buy Me A CoffeeDigitalOcean Referral Badge
Loading...
Edward Beazer

Edward Beazer - I just like to build shit. Sometimes I get stuck for hours, even days while trying to figure out how to solve an issue or implement a new feature. Hope my tips and tutorials can save you some time.

DigitalOcean Referral Badge