久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Android MultiDex - 關于內部工作的問題

Android MultiDex - Questions on Inner Workings(Android MultiDex - 關于內部工作的問題)
本文介紹了Android MultiDex - 關于內部工作的問題的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我最近發現了來自 Android 的新 MultiDex 功能,可用于處理具有 65,000 多個引用的應用程序.參見:https://developer.android.com/tools/building/multidex.html

I recently discovered the new MultiDex functionality from Android for working with apps having more than 65,000 references. See: https://developer.android.com/tools/building/multidex.html

誰能幫我理解以下問題:

Can someone help me understand the following questions:

1) Gradle 構建插件如何確定在主 dex 文件 (classes.dex) 和輔助 dex 文件中放置什么?根據文檔,主 dex 中需要某些東西,但它沒有給出任何示例.是否所有活動都必須在主 dex 文件中?

1) How does the Gradle build plugin determine what to put in the primary dex file (classes.dex) vs the secondary dex files? Based on the doc there are certain things required to be in primary dex but it doesn't give any examples. Are all activities required to be in the primary dex file?

引用文字:

對于需要哪些類有復雜的要求在 Dalvik 運行時執行時的主 dex 文件.安卓構建工具更新處理 Android 要求,但它是其他包含的庫可能有額外的依賴關系要求,包括使用自省或調用 Java來自本機代碼的方法.部分庫可能無法使用直到 multidex 構建工具更新以允許您指定必須包含在主 dex 文件中的類.

There are complex requirements regarding what classes are needed in the primary dex file when executing in the Dalvik runtime. The Android build tooling updates handle the Android requirements, but it is possible that other included libraries have additional dependency requirements including the use of introspection or invocation of Java methods from native code. Some libraries may not be able to be used until the multidex build tools are updated to allow you to specify classes that must be included in the primary dex file.

2) 僅為 Android API Level 21 (Android L) 及更高版本構建時,Gradle Build Plugin 中的行為有所不同.它說它要快得多,因為它將應用程序的每個模塊(包括依賴項)構建為單獨的 dex 文件.這通常稱為預 dexing."Android中模塊的定義是什么?這是這里提到的 Java 庫、Android 庫和 Android 應用程序模塊嗎:http://developer.android.com/sdk/installing/studio-build.html#projectModules?遠程或本地二進制依賴項(例如:Jars)是否算作單獨的模塊,因此會被放入不同的 dex 文件中,還是根據它們被包含在模塊中?

2) When building only for Android API Level 21 (Android L) and above, there is different behavior in the Gradle Build Plugin. It says it is much faster because it "Builds each module of the application (including dependencies) as separate dex files. This is commonly referred to as pre-dexing." What is the definition of a module in Android? Is this the Java Library, Android Library, and Android application modules mentioned here: http://developer.android.com/sdk/installing/studio-build.html#projectModules? Do Remote or Local Binary Dependencies (ex:Jars) count as separate modules and thus get put into a different dex file or do they get included in the module depending on them?

推薦答案

1) gradle 插件內部使用 Proguard 在 intermediates/multi-dex 構建文件夾中創建兩個 jar 文件.一個將是主 dex,其余的將分布在 dex 2、3 等上.

1) The gradle plugin internally uses Proguard to create two jar files in the intermediates/multi-dex build folder. One will be the primary dex, the rest will be spread out over dex 2, 3 etc.

collect{variant}MultiDexComponents 任務負責為proguard 創建keep 文件,你可以在我上面提到的文件夾的variant 特定子目錄中看到這個文件和其他proguard 參數.希望從長遠來看,這將是可定制的.

The collect{variant}MultiDexComponents task is responsible for creating the keep file for proguard, you can see this file and other proguard parameters used in the variant specific subdirectory of the folder I mentioned above. Hopefully this will be customisable in the long run.

目前還有一個與 gradle 插件的 1.0.0-rc1 中的測試項目相關的錯誤 (https://code.google.com/p/android/issues/detail?id=80741).通過一些小的更改,我在那里發布的解決方法也可用于立即將您自己的條目添加到保留列表中(從而確保您的類最終在主 dex 中).

There is also currently a bug relating to test projects in 1.0.0-rc1 of the gradle plugin (https://code.google.com/p/android/issues/detail?id=80741). With some small changes the workaround I posted there can also be used to add your own entries to the keep list (thus ensuring your classes end up in the primary dex) right now.

2) 從 Gradle 的角度來看,模塊是指模塊,但這些確實可以是您鏈接到的列表中提到的不同項目.如果您從命令行使用 --info 作為標志進行 pre-lollipop gradle 構建,您可以看到所有 dex 文件都被傳遞到 dx.(請注意,這不應該是啟用了 multidex 的構建或具有 preDexLibraries = false 的構建).

2) Modules refer to modules from a Gradle perspective, but these can indeed be the different items mentioned in the list you linked to. If you do a pre-lollipop gradle build from the commandline with --info as a flag you can see all the dex files being passed to dx. (Note that this should not a multidex enabled build or one with preDexLibraries = false).

這篇關于Android MultiDex - 關于內部工作的問題的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現 IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當前風味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復“意外元素lt;查詢gt;在“清單中找到錯誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風味庫的多風味應用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運行時有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫的傳遞依賴)
主站蜘蛛池模板: 一区二区三区网站 | 午夜丰满寂寞少妇精品 | 亚洲欧美久久 | 色www精品视频在线观看 | 三级视频在线观看 | 久久久久国产精品免费免费搜索 | 久久99网 | 亚洲国产精品网站 | 国产欧美一区二区三区另类精品 | 亚洲综合第一页 | 青青久久 | 亚洲www啪成人一区二区麻豆 | 久久久久精 | 久久久久久av | 亚洲欧洲成人在线 | 热99在线| 中文字幕亚洲视频 | 日韩欧美一级精品久久 | 狼色网| 另类在线 | 免费视频中文字幕 | 国产美女精品视频 | 国产精品一区二区免费 | 久草在线在线精品观看 | www.操.com | 国产精品久久久久久久久动漫 | 欧美性视频在线播放 | 欧美日韩大片 | 日韩在线一区二区 | 精品视频久久久久久 | 国产成人精品免高潮在线观看 | 午夜久久久久久久久久一区二区 | 亚洲高清视频在线观看 | 日韩欧美一区二区三区 | 日韩精品成人免费观看视频 | 国产成人精品网站 | 奇米av| 91精品国产色综合久久不卡蜜臀 | 亚洲高清在线 | 日韩视频专区 | 国产91九色|