How to handle the total number of Android methods more than 65536. The number of method references in a. dex file exceed 64k

Source: Internet
Author: User

One: Problem Description:

The number of Dex file methods in the app exceeds the maximum of 65536, and in simple terms, the application is bursting.

Second, the solution:

Scenario 1: Using a plug-in framework such as: https://github.com/singwhatiwanna/dynamic-load-apk

Scenario 2: Split Dex

three: How to implement the split Dex file

1. RELATED LINKS

Https://developer.android.com/tools/building/multidex.html#about

2, in the Build.gradle of the app

(1) Add in Dependencies

compile ' com.android.support:multidex:1.0.0 '

(2) Add in Defaultconfig

multidexenabled True

Like what

1 defaultconfig {2         applicationid "Com.pegasus.map"3         minsdkversion4         targetsdkversion5         versioncode 16         versionname "1.0"7         Signingconfig signingconfigs.config8         true9     }

(3) Add the application tag in the Androidmanifest.xml

1 <?xml version= "1.0" encoding= "Utf-8"?>2 <manifest xmlns:android= "/http Schemas.android.com/apk/res/android "3package     =" Com.example.android.multidex.myapplication ">4     <application5...         6         android:name= "Android.support.multidex.MultiDexApplication" >7         ... 8     </application>9 </manifest>

Tip: If your application Inherits application, then you need to rewrite

1 @Override 2     protected void Attachbasecontext (Context base) {3         Super . Attachbasecontext (base); 4         Multidex.install (this); 5     }

In addition, my public account number is: zhaoyanjun125

I will often send some of my project insights and programming techniques. Welcome attention.

Scan QR code follow me

How to handle the total number of Android methods more than 65536. The number of method references in a. dex file exceed 64k

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.