Android Studio Error while generating the main dex list

984 Views Asked by At

Im new to android app development, but im building an AR app that also uses glide to choose a piece of artwork from a website and then use the AR to hang in on a wall.

Im getting "Error while generating the main dex list" and im not sure why.

I had already built the main app and then imported the AR part from wikitude so im wondering if thats creating a conflict.

Im not sure if the best way to show you is to upload the project somewhere and then have someone look through it?

Thanks in advance

apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
    applicationId "codingwithmitch.com.recyclerview"
    minSdkVersion 19
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

    dexOptions {
        javaMaxHeapSize "4g"
    }

}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}



dependencies {

implementation (name: 'wikitudesdk', ext:'aar' )
implementation project(':arapp')
    implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
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'
//recyclerview
implementation 'com.android.support:recyclerview-v7:27.1.0'
//glide
implementation 'com.github.bumptech.glide:glide:4.4.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
//circle imageview
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'androidx.multidex:multidex:2.0.0'



}

This is for the augmented reality part

apply plugin: 'com.android.library'

android {
compileSdkVersion 27
buildToolsVersion '28.0.3'

defaultConfig {

    minSdkVersion 19
    targetSdkVersion 27
    multiDexEnabled true
    versionCode 1
    versionName "8.0.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
    }
}
}

dependencies {
 testImplementation 'junit:junit:4.12'
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation(name: 'wikitudesdk', ext: 'aar')
implementation 'com.google.ar:core:1.1.0'


}

repositories {
flatDir{
    dirs 'libs'
}
}
1

There are 1 best solutions below

2
Alexander Cavalheiro Becker On

Maybe you can try this, i'm not sure if it's going to work:

//In your app gradle file, inside "android":

dexOptions {
        javaMaxHeapSize "4g"
    }

//Also in your app gradle file, inside "dependencies":
implementation 'androidx.multidex:multidex:2.0.0'