Solutions for more than 65535 Android engineering methods

Source: Internet
Author: User

    • Error:execution failed for task ': Ttt:transformclasseswithdexfordebug '.
      Com.android.build.api.transform.TransformException:com.android.ide.common.process.ProcessException: Java.util.concurrent.ExecutionException:com.android.dex.DexIndexOverflowException:method ID not in [0, 0xFFFF]: 65536

      Unfortunately, I met today, the integration of a Udesk customer service function, import its moudle, inside a mess into a lot of third-party. As a third party customer service, is this really good for you?

Solution Solutions
  1. Gradle configuration: In the app's Build.gradle

      android {        defaultConfig {        applicationId "com.xxx.xxx"        minSdkVersion 14 targetSdkVersion 21 multiDexEnabled true //加上这句话 } }
  2. Gradle configuration: In the app's Build.gradle

      dependencies {        compile ‘com.android.support:multidex:1.0.1‘    }
  3. Your own application class override method:

      @Override                             protected void attachBaseContext(Context base) { super.attachBaseContext(base); MultiDex.install(this); }

    You can also inherit the Android.support.multidex.MultiDexApplication class without overriding the method above

  4. If your app contains a referenced lirary project or moudle, you need to set the precompilation to false:

    android {        // ...        dexOptions {            preDexLibraries = false        }   }
  5. When running, if you see the following error:

    Unexpected top-level ERROR:
    Java.lang.OutOfMemoryError:Java Heap Space

    In Dexoptions, there is a field to increase the Java heap memory size:

      android {        // ...        dexOptions {            javaMaxHeapSize "2g"        }    }

Solutions for more than 65535 Android engineering methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.