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

build.gradle 中的新 applicationId 是如何工作的?

How does the new applicationId in build.gradle work?(build.gradle 中的新 applicationId 是如何工作的?)
本文介紹了build.gradle 中的新 applicationId 是如何工作的?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

Google 發布了 0.11 版的 Android Gradle 插件.

Google released version 0.11 of the Android Gradle plugin.

發行說明包含以下內容:

The release notes contains the following:

0.11 中用戶可見的變化之一是我們已棄用packageName 和 packageNameSuffix 設置,并將它們重命名為applicationId 和 applicationIdSuffix.這樣做的目的是使很明顯,此應用程序 ID 與包分離清單中的聲明,特別是 R 類和BuildConfig 類,以及應用程序中的所有實現類,可以自由重命名和重構;你只需要保持applicationId 相同.如果你打開你的 build.gradle 文件,lint 是突出顯示這些已棄用的調用并提供快速修復以進行更新他們:

One of the user visible changes in 0.11 is that we've deprecated the packageName and packageNameSuffix settings, and have renamed them to applicationId and applicationIdSuffix. The purpose of this is to make it clear that this application id is decoupled from package declarations in your manifest, and in particular, the R class and the BuildConfig class, and all the implementation classes inside your app, can be renamed and refactored freely; you just need to keep applicationId the same. If you open your build.gradle file, lint is highlighting these deprecated calls and offering quickfixes to update them:

這究竟是什么意思.構建腳本中的包名如何與清單中的包名解耦?

What exactly does this mean. How is the packagename in the build script decoupled from the one in the manifest?

推薦答案

package 標識設備上安裝的一個應用程序.屬性名稱本身具有誤導性,因為人們可能認為重構 java 類可能還需要重命名 package 屬性.package 屬性可以是任何符合 javadoc 中描述的限制的字符串.

package specified in AndroidManifest.xml identify one application installed on the device. The name of the property itself is misleading because one may think that refactoring java classes may require renaming package property as well. package property can be any string respecting limitation described in javadoc.

由于這種混淆,Google 家伙決定將 package 重命名為 applicationId.但是,此更改僅適用于 gradle 文件.更改清單屬性名稱會破壞與以前版本的兼容性,這是我的猜測.

Because this confusion Google guys decided to rename package to applicationId. However, this change apply to gradle file only. Changing manifest property name would break compatibility with previous versions, that's my guess.

因此,當您構建 APK 時,gradle 會將清單的 package 屬性值替換為 gradle 腳本中指定的 applicationId 值.

So when you build your APK, gradle replaces manifest's package property value with applicationId value specified in gradle script.

如果您想自己測試.只需將 applicationId 設置為與清單的 package 不同的值并構建 APK.然后轉到文件夾 /build/intermediates/manifests/dev/debug 并打開 AndroidManifest.xml.你會在那里找到 applicationId 值.

If you would like to test it yourself. Just set applicationId with different value that your manifest's package and build APK. Then go to folder /build/intermediates/manifests/dev/debug and open AndroidManifest.xml. You will find there applicationId value.

這篇關于build.gradle 中的新 applicationId 是如何工作的?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 庫的傳遞依賴)
主站蜘蛛池模板: 一区二区三区视频播放 | 中文字幕在线观看国产 | 青青草一区 | 国产永久免费 | 亚洲成人免费av | 噜噜噜噜狠狠狠7777视频 | 欧美男人亚洲天堂 | 伊人伊人 | 中文字幕日韩欧美 | 国产精品毛片无码 | 日韩精品在线视频免费观看 | 99久久精品免费看国产免费软件 | 欧美a免费 | 亚洲精品免费在线 | 99爱国产 | 成人av在线播放 | 91亚洲国产成人久久精品网站 | 成人综合在线视频 | 日本不卡一区二区三区 | 91精品在线观看入口 | 日韩欧美高清 | 二区视频| 久久久久国产精品午夜一区 | 成人在线视频一区 | 日韩喷潮 | 国产成人精品免费视频 | 91视频a| 日韩精品一区二区三区视频播放 | 黄色大片免费观看 | 夜夜草 | 成人精品在线观看 | 成人性视频免费网站 | 男女羞羞视频在线观看 | 精品91 | 欧美一区二区三区在线 | 国产精品视频免费观看 | 一区二区日韩 | 成年人黄色一级片 | 男人天堂99 | 性精品| 久久精品国产亚洲 |