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

Android MultiDex - 關(guān)于內(nèi)部工作的問(wèn)題

Android MultiDex - Questions on Inner Workings(Android MultiDex - 關(guān)于內(nèi)部工作的問(wèn)題)
本文介紹了Android MultiDex - 關(guān)于內(nèi)部工作的問(wèn)題的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我最近發(fā)現(xiàn)了來(lái)自 Android 的新 MultiDex 功能,可用于處理具有 65,000 多個(gè)引用的應(yīng)用程序.參見(jiàn):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

誰(shuí)能幫我理解以下問(wèn)題:

Can someone help me understand the following questions:

1) Gradle 構(gòu)建插件如何確定在主 dex 文件 (classes.dex) 和輔助 dex 文件中放置什么?根據(jù)文檔,主 dex 中需要某些東西,但它沒(méi)有給出任何示例.是否所有活動(dòng)都必須在主 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?

引用文字:

對(duì)于需要哪些類(lèi)有復(fù)雜的要求在 Dalvik 運(yùn)行時(shí)執(zhí)行時(shí)的主 dex 文件.安卓構(gòu)建工具更新處理 Android 要求,但它是其他包含的庫(kù)可能有額外的依賴關(guān)系要求,包括使用自省或調(diào)用 Java來(lái)自本機(jī)代碼的方法.部分庫(kù)可能無(wú)法使用直到 multidex 構(gòu)建工具更新以允許您指定必須包含在主 dex 文件中的類(lèi).

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) 及更高版本構(gòu)建時(shí),Gradle Build Plugin 中的行為有所不同.它說(shuō)它要快得多,因?yàn)樗鼘?yīng)用程序的每個(gè)模塊(包括依賴項(xiàng))構(gòu)建為單獨(dú)的 dex 文件.這通常稱(chēng)為預(yù) dexing."Android中模塊的定義是什么?這是這里提到的 Java 庫(kù)、Android 庫(kù)和 Android 應(yīng)用程序模塊嗎:http://developer.android.com/sdk/installing/studio-build.html#projectModules?遠(yuǎn)程或本地二進(jìn)制依賴項(xiàng)(例如:Jars)是否算作單獨(dú)的模塊,因此會(huì)被放入不同的 dex 文件中,還是根據(jù)它們被包含在模塊中?

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 插件內(nèi)部使用 Proguard 在 intermediates/multi-dex 構(gòu)建文件夾中創(chuàng)建兩個(gè) jar 文件.一個(gè)將是主 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 任務(wù)負(fù)責(zé)為proguard 創(chuàng)建keep 文件,你可以在我上面提到的文件夾的variant 特定子目錄中看到這個(gè)文件和其他proguard 參數(shù).希望從長(zhǎng)遠(yuǎn)來(lái)看,這將是可定制的.

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.

目前還有一個(gè)與 gradle 插件的 1.0.0-rc1 中的測(cè)試項(xiàng)目相關(guān)的錯(cuò)誤 (https://code.google.com/p/android/issues/detail?id=80741).通過(guò)一些小的更改,我在那里發(fā)布的解決方法也可用于立即將您自己的條目添加到保留列表中(從而確保您的類(lèi)最終在主 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 的角度來(lái)看,模塊是指模塊,但這些確實(shí)可以是您鏈接到的列表中提到的不同項(xiàng)目.如果您從命令行使用 --info 作為標(biāo)志進(jìn)行 pre-lollipop gradle 構(gòu)建,您可以看到所有 dex 文件都被傳遞到 dx.(請(qǐng)注意,這不應(yīng)該是啟用了 multidex 的構(gòu)建或具有 preDexLibraries = false 的構(gòu)建).

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).

這篇關(guān)于Android MultiDex - 關(guān)于內(nèi)部工作的問(wèn)題的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

IncompatibleClassChangeError after updating to Android Build Tools 25.1.6 GCM / FCM(更新到 Android Build Tools 25.1.6 GCM/FCM 后出現(xiàn) IncompatibleClassChangeError)
How to get current flavor in gradle(如何在 gradle 中獲取當(dāng)前風(fēng)味)
How to fix quot;unexpected element lt;queriesgt; found in lt;manifestgt;quot; error?(如何修復(fù)“意外元素lt;查詢gt;在“清單中找到錯(cuò)誤?)
Multi flavor app based on multi flavor library in Android Gradle(基于 Android Gradle 中多風(fēng)味庫(kù)的多風(fēng)味應(yīng)用)
Android dependency has different version for the compile and runtime(Android 依賴在編譯和運(yùn)行時(shí)有不同的版本)
Transitive dependencies for local aar library(本地 aar 庫(kù)的傳遞依賴)
主站蜘蛛池模板: 国产成人免费视频 | 999精品在线 | 93久久精品日日躁夜夜躁欧美 | 欧美日韩国产三级 | 免费av播放 | 欧美精产国品一二三区 | 夜夜嗷| 美女视频福利 | 中文字幕第一区 | 天堂网亚洲| 中文字幕有码在线 | 午夜在线视频 | 久久久久国产一区二区三区 | 日韩一区在线播放 | 国产免费a| 日韩不卡av| 日韩视频免费在线观看 | 三级黄视频| 亚洲91av| 黄色片网站视频 | 欧美精品网 | 国产日韩综合 | 日本高清www | 精品一区二区三区三区 | 精品国产精品三级精品av网址 | 黄色小说网站在线观看 | 亚洲国产成人在线 | 国产成人三级一区二区在线观看一 | av不卡一区 | 国产无精乱码一区二区三区 | 日产精品久久久一区二区 | 日韩色在线 | 黄色在线播放 | 激情视频网址 | 亚洲午夜久久久 | 免费一级片 | 亚洲午夜在线观看 | 国产精品三 | 亚洲综合网站 | 黄色激情视频在线观看 | 91蝌蚪少妇偷拍 |