Android package MultiDex principle explanation, android package multidexBackground of MultiDex
When the Android system installs an application, one step is to optimize Dex. In this process, there is a dedicated tool for processing, called DexOpt. DexOpt is executed when Dex files are loaded for the first time. This process generates an ODEX file, Optimised Dex. Execution of ODex is much more efficient than
Android package MultiDex policy details, android package multidex
1. Subcontracting background
First, we will introduce the background of MultiDex.
When the Android system installs an application, one step is to optimize Dex. In this process, there is a dedicated tool for processing, called DexOpt. DexOpt is executed when Dex files are loaded for the first time.
Detailed explanation of Android packet MultiDex principlesBackground of MultiDex
When the Android system installs an application, one step is to optimize Dex. In this process, there is a dedicated tool for processing, called DexOpt. DexOpt is executed when Dex files are loaded for the first time. This process generates an ODEX file, Optimised Dex. Execution of ODex is much more efficient than direct executi
API has provided a common solution. That's Android-support-multidex.jar. This jar package has the lowest support for API 4 version number (Android L and the above version number will default to support Mutidex).let's see how to apply Android-support-multidex.jar (The following are examples of use in Anroid Studio, where you need to install the Gradle plugin to use Eclipse development.) Other basically the same ):can be resolved first with--multi-dex configuration (build.gradle), the generated a
Android uses android-support-multidex to solve the problem of Dex exceeding the limit of the number of methods, so that your application will not burst into the dark. androidmultidex
If you have reprinted, please declare the Source: sand: http://blog.csdn.net/t12x3456 (from the sand csdn blog)
With the continuous iteration of applications and the expansion of business lines, applications become larger and larger (such as integrating various third-part
official solution is the most reassuring. Finally, we still wait for you, Multidex offical solution.I recommend the official documentation and this GitHub article to see a better understanding, less detours.Let's talk about the steps used:1. Modify Gradle, import ' com.android.support:multidex:1.0.0 ', open multidexenabled;Android {compilesdkversion +buildtoolsversion"21.1.0"defaultconfig {... minsdkversion -targetsdkversion + ... //ena
application. Dalvik executable specification limit a Dex file contains 65,536 methods: The Android Framework method, the total number of library methods, and the total number of your own code methods. Because 65536 equals 64x1024, this limit is referred to as a "64k reference limit."This limit requires us to configure the application build process, need to generate multiple Dex files, so called Multidex configuration.
Analysis of causes and precauti
Android uses android-support-multidex to solve the problem of Dex exceeding the limit on the number of methods, so that your applications will not burst
With the continuous iteration of applications and the expansion of business lines, applications become larger and larger (such as integrating various third-party sdks or jar packages supported by the public, with high project coupling and repeated classes ), I believe many people have encountered the
Androidstudio using Android-support-multidex to solve 65536 problem 64k problem
Copyright NOTICE: Reprint Please specify this article to the blog from Zhangjie: http://blog.csdn.net/yanzhenjie1003
64k of various anomaliesError:the number of method references in a. dex file cannot exceed 64K.Learn how to resolve the issue at https://developer.android.com/tools/building/multidex.htmlOrFinished with Non-zero exit value 2When your applicatio
Android 65K problem believe that a lot of people confused, although as the out can be through the division Dex High-speed solution 65K problem, but also easy because some code is not packaged into the maindex caused byNoclassdeffounderror。With the launch of 5.0, Android also released the Multidex Support library to solve the problem.The Multidex Support Library is able to directly subcontract 65K issues. An
Analysis of Dex splitting (MultiDex) technology in AndroidI. Preface
The subcontracting Technology in Android is no longer a new technology, and there is a lot of analysis on the Internet, but they all give theoretical knowledge and Principle Analysis, and there is no detailed case description, so here we will explain in detail the analysis of the dex splitting technology in Android. Before explaining this, let's take a look at why this technology has
wants to illustrate and solve. Dexopt will retrieve the method ID of each class, and there is a list structure inside. However, the length of the list is saved with a short type, resulting in no more than 65,536 method IDs. When a project is large enough, it is clear that the upper limit of this method is not enough. Although dexopt fixed this issue in the new version of Android, we still need to be compatible with the low-version Android system.The following is the specific configuration using
efficient than executing Dex files directly. But in earlier Android systems, there was a limit to the linearalloc of dexopt : android 2.2 and 2.3 had only 5mb,android 4 buffers. x increased to 8MB or 16MB. When the number of methods exceeds the buffer size, dexopt crashes, causing the installation to fail. Of course,Google seems to be aware of the current number of application methods of the problem, now in the API has provided a common solution, that is Android-support-multidex.jar . Th
We are in the development of projects, like to introduce a lot of third-party packages, greatly facilitate our development, but at the same time, because the total number of Android methods can not exceed 65k, however, with our development, 65k will eventually exceed, so, Google gives this solution, But has been curious about how it is implemented internally, we come today according to the source code to see what the package did, how to put multiple Dex read out. Let's look at the categories in
When xposed hook is used for multiple Dex applications, xposed throws the classnotfound exception because it only searches for classes in classes. Dex. The following official solution is not perfect. For details, refer to #30 issue on GitHub. Public Class Redclock Implements Ixposedhookloadpackage { Public Void Handleloadpackage (loadpackageparam lpparam) Throws Throwable { Final Loadpackageparam llpm =Lpparam; If (! Lpparam. packagename. Equals ("com. XXX" )) Return ; Findandhookmet
Environment Gradle 2.2 (if the version is different. The following script needs to adjust the Com.android.tools.build:gradle version number)
Build.gradle (note the place marked red)
Buildscript {repositories {mavencentral ()} dependencies
:
trouble writing output:Too many field references: 131000; max is 65536.You may try using --multi-dex option.
The two errors show a common number: 65536. This number indicates the total number of callable methods for a single Dalvik executable (DEX) bytecode file. If you have already created an android Application and received this error, congratulations! You have too many code! This document describes how to break through this restriction and continue to build your app.About the 65 K Reference
Android applications limit the number of 65 k methods, and android applications limit the number of 65 k
Recently, Android Developers announced a new Multidex support library on Google +, providing official support for Android applications whose total number of methods exceeds K.
If you are a lucky Android application developer who is developing a promising application, constantly adding new functions and adding new class libraries, one day, you will
Android developers recently announced a new Multidex support library on Google +, providing official support for Android apps with a total of over 65K.If you're a lucky Android app developer and you're developing a promising app that's constantly adding new features and adding new libraries, one day you'll unfortunately encounter this error:Conversion to Dalvik format failed:unable to execute Dex:method ID not in [0, 0xFFFF]: 65536This error is caused
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.