pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

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 庫的傳遞依賴)
主站蜘蛛池模板: MES系统工业智能终端_生产管理看板/安灯/ESOP/静电监控_讯鹏科技 | 企业彩铃制作_移动、联通、电信集团彩铃上传开通_彩铃定制_商务彩铃管理平台-集团彩铃网 | 起好名字_取个好名字_好名网免费取好名在线打分 | 心得体会网_心得体会格式范文模板| 铣刨料沥青破碎机-沥青再生料设备-RAP热再生混合料破碎筛分设备 -江苏锡宝重工 | 尚为传动-专业高精密蜗轮蜗杆,双导程蜗轮蜗杆,蜗轮蜗杆减速机,蜗杆减速机生产厂家 | 上海平衡机-单面卧式动平衡机-万向节动平衡机-圈带动平衡机厂家-上海申岢动平衡机制造有限公司 | 气体热式流量计-定量控制流量计(空气流量计厂家)-湖北南控仪表科技有限公司 | 河南膏药贴牌-膏药代加工-膏药oem厂家-洛阳今世康医药科技有限公司 | 气密性检测仪_气密性检测设备_防水测试仪_密封测试仪-岳信仪器 | 小型气象站_便携式自动气象站_校园气象站-竞道气象设备网 | 新车测评网_网罗汽车评测资讯_汽车评测门户报道| 气动|电动调节阀|球阀|蝶阀-自力式调节阀-上海渠工阀门管道工程有限公司 | 华禹护栏|锌钢护栏_阳台护栏_护栏厂家-华禹专注阳台护栏、楼梯栏杆、百叶窗、空调架、基坑护栏、道路护栏等锌钢护栏产品的生产销售。 | 齿轮减速马达一体式_蜗轮蜗杆减速机配电机-德国BOSERL齿轮减速电动机生产厂家 | 行吊_电动单梁起重机_双梁起重机_合肥起重机_厂家_合肥市神雕起重机械有限公司 | 云南成考网_云南成人高考报名网 粤丰硕水性环氧地坪漆-防静电自流平厂家-环保地坪涂料代理 | 凝胶成像仪,化学发光凝胶成像系统,凝胶成像分析系统-上海培清科技有限公司 | 深圳公司注册-工商注册公司-千百顺代理记账公司 | 大连海岛旅游网>>大连旅游,大连海岛游,旅游景点攻略,海岛旅游官网 | 钢板仓,大型钢板仓,钢板库,大型钢板库,粉煤灰钢板仓,螺旋钢板仓,螺旋卷板仓,骨料钢板仓 | 北京包装设计_标志设计公司_包装设计公司-北京思逸品牌设计 | 施工围挡-施工PVC围挡-工程围挡-深圳市旭东钢构技术开发有限公司 | 政府园区专业委托招商平台_助力企业选址项目快速落地_东方龙商务集团 | 太阳能发电系统-太阳能逆变器,控制器-河北沐天太阳能科技首页 | 飞行者联盟-飞机模拟机_无人机_低空经济_航空技术交流平台 | 掺铥光纤放大器-C/L波段光纤放大器-小信号光纤放大器-合肥脉锐光电技术有限公司 | 橡胶接头_橡胶软接头_可曲挠橡胶接头-巩义市创伟机械制造有限公司 | 自动气象站_气象站监测设备_全自动气象站设备_雨量监测站-山东风途物联网 | 悬浮拼装地板_幼儿园_篮球场_悬浮拼接地板-山东悬浮拼装地板厂家 | 烟台条码打印机_烟台条码扫描器_烟台碳带_烟台数据采集终端_烟台斑马打印机-金鹏电子-金鹏电子 | 无线联网门锁|校园联网门锁|学校智能门锁|公租房智能门锁|保障房管理系统-KEENZY中科易安 | 不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰]-不锈钢法兰-碳钢法兰-法兰盘生产加工厂家-[鼎捷峰] | 垃圾处理设备_餐厨垃圾处理设备_厨余垃圾处理设备_果蔬垃圾处理设备-深圳市三盛环保科技有限公司 | 手术室净化厂家_成都实验室装修公司_无尘车间施工单位_洁净室工程建设团队-四川华锐16年行业经验 | 天津拓展_天津团建_天津趣味运动会_天津活动策划公司-天津华天拓展培训中心 | 汽液过滤网厂家_安平县银锐丝网有限公司 | 大流量卧式砂磨机_强力分散机_双行星双动力混合机_同心双轴搅拌机-莱州市龙跃化工机械有限公司 | 润滑脂-高温润滑脂-轴承润滑脂-食品级润滑油-索科润滑油脂厂家 | 琉璃瓦-琉璃瓦厂家-安徽盛阳新型建材科技有限公司 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 |