欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

如何解決Androidstudio升級到3.0之后運行時的問題示例-創(chuàng)新互聯(lián)

這篇文章主要為大家展示了“如何解決Android studio升級到3.0之后運行時的問題示例”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領大家一起研究并學習一下“如何解決Android studio升級到3.0之后運行時的問題示例”這篇文章吧。

為濱海等地區(qū)用戶提供了全套網(wǎng)頁設計制作服務,及濱海網(wǎng)站建設行業(yè)解決方案。主營業(yè)務為網(wǎng)站設計制作、成都網(wǎng)站建設、濱海網(wǎng)站設計,以傳統(tǒng)方式定制建設網(wǎng)站,并提供域名空間備案等一條龍服務,秉承以專業(yè)、用心的態(tài)度為用戶提供真誠的服務。我們深信只要達到每一位用戶的要求,就會得到認可,從而選擇與我們長期合作。這樣,我們也可以走得更遠!

這個問題是Android studio升級到3.0之后,運行的時候會提示gradle要升級到3.5版本才能編譯。于是我把我的gradle升級到了

 gradle-4.1-milestone-1 版本,是2017年7月份最新版本了。

于是我把主程序的build.gradle中的gradle版本改成了這個,具體指定哪個版本我也不知道,于是就寫了個3.0+

 dependencies {
 classpath 'com.android.tools.build:gradle:3.0+' 
}

然后再次編譯,又發(fā)現(xiàn)了毒。

提示:Error:All flavors must now belong to a named flavor dimension.Learn more at https://d.android.com/r/tools/flavorDimensions-missing-error-message.html

這個一個錯誤,意思是:所有的flavors都必須屬于同一個風格。

=。=懵逼

去翻墻看了它提供的地址才知道:

 Plugin 3.0.0 includes a new dependency mechanism that automatically matches variants when consuming a library. This means an app's debug variant automatically consumes a library's debug variant, and so on. It also works when using flavors—an app's redDebug variant will consume a library's redDebug variant. To make this work, the plugin now requires that all flavors belong to a named flavor dimension —even if you intend to use only a single dimension. Otherwise, you will get the following build error:
[cpp] view plain copy
Error:All flavors must now belong to a named flavor dimension. 
The flavor 'flavor_name' is not assigned to a flavor dimension. 
 To resolve this error, assign each flavor to a named dimension, as shown in the sample below. Because dependency matching is now taken care of by the plugin, you should name your flavor dimensions carefully. For example, if all your app and library modules use the foo dimension, you'll have less control over which flavors are matched by the plugin.

// Specifies a flavor dimension. 
flavorDimensions "color" 
productFlavors { 
  red { 
  // Assigns this product flavor to the 'color' flavor dimension. 
  // This step is optional if you are using only one dimension. 
  dimension "color" 
  ... 
 } 
 blue { 
  dimension "color" 
  ... 
 } 
}

大致是說,Plugin 3.0.0之后有一種自動匹配消耗庫的機制,便于debug variant 自動消耗一個庫,然后就是必須要所有的flavor 都屬于同一個維度。

為了避免flavor 不同產(chǎn)生誤差的問題,應該在所有的庫模塊都使用同一個foo尺寸。

= 。=還是懵逼。說一堆依然不是很理解。

但是我們從中已經(jīng)知道解決方案了:

在主app的build.gradle里面的

 defaultConfig {
 targetSdkVersion:***
minSdkVersion :***
versionCode:***
 versionName :***
//版本名后面添加一句話,意思就是flavor dimension 它的維度就是該版本號,這樣維度就是都是統(tǒng)一的了
flavorDimensions "versionCode"
}

以上是“如何解決Android studio升級到3.0之后運行時的問題示例”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學習更多知識,歡迎關注創(chuàng)新互聯(lián)行業(yè)資訊頻道!

分享文章:如何解決Androidstudio升級到3.0之后運行時的問題示例-創(chuàng)新互聯(lián)
文章分享:http://chinadenli.net/article48/cojdhp.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制網(wǎng)站域名注冊外貿(mào)網(wǎng)站建設營銷型網(wǎng)站建設網(wǎng)站設計做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都定制網(wǎng)站網(wǎng)頁設計