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