0

I'm trying to import this driver to my simple app (at the moment just only the default text view) in android 3.5 version. The driver library was installed and wanted to run the emulator and I encountered several Gradle issues and was able to fix them and finally ended up here. When I entered,

classpath 'com.android.support:multidex:1.0.3'

in the Gradle.

though the build successful, when I run the app I received the build error as mentioned below.

com.android.tools.r8.CompilationFailedException: Compilation failed to complete
com.android.tools.r8.utils.AbortException: Error: null, Cannot fit requested classes in a single dex file (# methods: 114237 > 65536)

Further, I'm not sure where to put (as in this)

multiDexEnabled true

and (as in this) ,

    packagingOptions {
    exclude 'META-INF/DEPENDENCIES'
    exclude 'META-INF/INDEX.LIST'
}

since my build.gradle is as below,

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        google()
        jcenter()
        maven {
            url "http://dl.bintray.com/shimmerengineering/Shimmer"
        }

    }
dependencies {
    classpath 'com.android.tools.build:gradle:3.5.1'
    apply plugin: 'eclipse'
    classpath 'com.android.support:multidex:1.0.3'


    // NOTE: Do not place your application dependencies here; they belong
    // in the individual module build.gradle files
}
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
            url "http://dl.bintray.com/shimmerengineering/Shimmer"
        }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

Any suggestion on how to fix this?

~ Thank you ~


Fixed as below :

Created a new test application and found the build.gradle file and included

allprojects { repositories { jcenter() maven { url "dl.bintray.com/shimmerengineering/Shimmer" } } }

then the arrived issues were fixed as in this and this. Then when running the emulator there were no build or any other issues.

Sachz
  • 391
  • 5
  • 21
  • You are looking at the wrong `build.gradle` file. The things that you cited need to be added to the `build.gradle` file for your module (e.g., `app/build.gradle`). – CommonsWare Oct 20 '19 at 14:44
  • Oh ! well I have now created a new test application and found the build.Gradle file and included 'allprojects { repositories { jcenter() maven { url "http://dl.bintray.com/shimmerengineering/Shimmer" } } }' – Sachz Oct 20 '19 at 15:18
  • Then again faced the same issues as in [link] (https://stackoverflow.com/questions/48958884/error-more-than-one-file-was-found-with-os-independent-path-meta-inf-dependenc) and as in this [link] https://stackoverflow.com/questions/48249633/errorcannot-fit-requested-classes-in-a-single-dex-file-try-supplying-a-main-dex. I was able to fix the issues. And emulator worked with text view !!! Hopefully, I can continue now !!! Thank you for the support !!! – Sachz Oct 20 '19 at 15:18

1 Answers1

1

Try making maximum hip size to 4 Gigabyte in app level gradle

android {
    compileSdkVersion 28
    buildToolsVersion '28.0.3'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 28

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
        multiDexEnabled true
    }
    dexOptions {
        javaMaxHeapSize "4g"//this line
    }
touhid udoy
  • 4,005
  • 2
  • 18
  • 31
  • Thank you for the guide, but this didn't work for me. I have changed the Gradle file now and then it worked after some fixes of the issues. – Sachz Oct 20 '19 at 15:17