Fix "Com.android.dex.DexIndexOverflowException:method ID not in [0, 0xFFFF]: 65935" issue on Android Studio

Source: Internet
Author: User

I was in the process of changing the application of a jar package that occurred when the error, on the internet to say that because of the introduction of a number of third-party jar in the project, resulting in the number of calls to more than 65,935 of the Android set (Dex 64K problem), resulting in Dex can not be generated, You will not be able to generate the APK file.

The solution is as follows:

1. Add the sub-package settings in the Dependencies section of the project's Build.gradle file:

dependencies {...    Compile ' com.android.support:multidex: '    ...}

2. Turn on multi-dexing support by setting the multidexenabled tag to true in the Defaultconfig section.

Defaultconfig {    ... multidexenabled true ...}

3. Three kinds of situations:

A. If you have not created your own application.class, add it directly in the application declaration of the Androidmanifest.xml file;

Android:name= "Android.support.multidex.MultiDexApplication"

B. You have created your own application, then replace the android.app.Application you inherited with Android.support.multidex.MultiDexApplication

C. If your application inherits some of the other classes, and you do not want to change it, then rewrite Attachbasecontext () as below.

 Public class MyApplication extends Fooapplication {    @Override    protectedvoidbase ) {       super.attachbasecontext (base);       Multidex.install (this);    } }

4. The compilation process may be low on memory. To fix it, set the following

dexoptions {    true   "4g"}    

5, re-build, generate signature apk, install and use normal.

(PS: I was using 1, 2 steps after compiling the installation OK, so did not go down)

Reference: http://www.cnblogs.com/yeahgis/p/4660873.html

Http://stackoverflow.com/questions/27377080/after-update-of-as-to-1-0-getting-method-id-not-in-0-0xffff-65536-error-i

Fix "Com.android.dex.DexIndexOverflowException:method ID not in [0, 0xFFFF]: 65935" issue on Android Studio

Related Article

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.