最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

更新Android Studio 3.0碰到的問題小結(jié)

 更新時(shí)間:2017年11月07日 10:29:33   作者:Sam  
本文是小編給大家分享的更新Android Studio 3.0碰到的問題小結(jié),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友參考下吧

更新完后試下運(yùn)行正在維護(hù)的舊項(xiàng)目,出現(xiàn)各種錯(cuò)誤,因?yàn)楹髞戆l(fā)現(xiàn)問題不在這,所以沒記完整,大概如下:

A larger heap for the Gradle daemon is recommended for running jack.

It currently has 512 MB.
For faster builds, increase the maximum heap size for the Gradle daemon to at least 1536 MB.
To do this set org.gradle.jvmargs=-Xmx1536M in the project gradle.properties.

然后查看gradle.properties我的org.gradle.jvmargs已經(jīng)是2048了,另外還有個(gè)Error:UNEXPECTED TOP-LEVEL ERROR:錯(cuò)誤

搜索了一下并沒找到要點(diǎn),于是Build一下項(xiàng)目,提示

Error:Failed to complete Gradle execution.

Cause:

The version of Gradle you are using (3.3) does not support the forTasks() method on BuildActionExecuter. Support for this is available in Gradle 3.5 and all later versions.

于是更新使用Gradle最新版,新建一個(gè)項(xiàng)目看看默認(rèn)用的什么版本,修改以下文件

gradle-wrapper.properties里

distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

APP的build.gradle里

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

編譯后又有錯(cuò)

Cannot set the value of read-only property 'outputFile'....

因?yàn)槭褂昧司幾g輸出文件名的代碼

applicationVariants.all { variant ->
 variant.outputs.each { output ->
 def outputFile = output.outputFile
 def fileName
 if (outputFile != null && outputFile.name.endsWith('.apk')) {
  if (variant.buildType.name.equals('release')) {
  // 輸出apk名稱為Test_v_1.0_15-09-15 11:12:32_official_release.apk
  fileName = "Test_v_${defaultConfig.versionName}_${releaseTime()}_${variant.productFlavors[0].name}_release.apk"
  } else if (variant.buildType.name.equals('debug')) {
  // 輸出apk名稱為Test_v_1.0_15-09-15 11:12:32_official_debug.apk
  fileName = "Test_v_${defaultConfig.versionName}_${releaseTime()}_${variant.productFlavors[0].name}_debug.apk"
  }
  output.outputFile = new File(outputFile.parent, fileName)
 }
 }
}

出錯(cuò)在最后一行,應(yīng)該是新版Gradle的問題,最后在Stackover Flow找到解決辦法,參考

https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property

variant.outputs.each 改成

     variant.outputs.all

最后一行改成

outputFileName = fileName

繼續(xù)編譯繼續(xù)出錯(cuò)

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

百度找到以下文章,修改后就可以正常編譯運(yùn)行了

http://www.fzitv.net/article/127673.htm

看了幾個(gè)文章也搞不清楚這個(gè)是什么來的,照著改項(xiàng)目的build.gradle

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

項(xiàng)目的其它代碼不用改,文章開頭的錯(cuò)誤全沒了,還好沒浪費(fèi)太多時(shí)間

PS:下面看下更新AndroidStudio到3.0后遇到的一個(gè)編譯問題

今天晚上更新了AndroidStudio,可是再用這個(gè)就發(fā)現(xiàn)一個(gè)編譯問題:

Error:java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details 
Error:Execution failed for task ':app:mergeDebugResources'. 
> Error: java.util.concurrent.ExecutionException: com.android.tools.aapt2.Aapt2Exception: AAPT2 error: check logs for details 

通過google,發(fā)現(xiàn)了解決辦法:

在項(xiàng)目的gradle.properties中添加

android.enableAapt2=false 

目前還沒搞懂為什么,先留在這里吧

總結(jié)

以上所述是小編給大家介紹的更新Android Studio 3.0碰到的問題小結(jié),希望對(duì)大家有所幫助,如果大家有任何疑問請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!

相關(guān)文章

最新評(píng)論

龙口市| 蓝田县| 象山县| 固镇县| 鄄城县| 嘉荫县| 山东省| 四会市| 茂名市| 重庆市| 云安县| 五原县| 承德县| 三都| 咸阳市| 东安县| 昆山市| 邯郸县| 石台县| 天镇县| 东台市| 襄城县| 遵化市| 资溪县| 甘洛县| 徐水县| 和政县| 塔城市| 临夏市| 温宿县| 鲜城| 澄城县| 沽源县| 宜兰市| 沙河市| 深州市| 永平县| 建德市| 陵川县| 松滋市| 剑川县|