全部的環境都配置好了,將新建立的weex項目導入到Android studio中的時候,出現的錯誤。

關於android studio升級3.0之後自動輸出apk名的報錯問題

個人安裝之路,與bug鬥智鬥勇!!!!html

升級gradle到3.0.1的時候,app.gradle報了以下幾種錯誤錯誤:主要是將之前的output.outputFile替換爲outputFileName。java

第一種狀況:android

Could not get unknown property 'outputFile' for BuildType_Decorated{name=output, debuggable=false, testCoverageEnabled=false, jniDebuggable=false, pseudoLocalesEnabled=false, renderscriptDebuggable=false, renderscriptOptimLevel=3, minifyEnabled=false, zipAlignEnabled=true, signingConfig=null, embedMicroApp=true, app

第二種狀況:gradle

Ambiguous method overloading for method java.io.File# . Cannot resolve which method to invoke for [class java.lang.String, null] due to overlapping prototypes between: [class java.lang.String, class java.lang.String] [class java.lang.String, class java.io.File] Open Fileui

第三種狀況:this

No signature of method: java.util.ArrayList.endsWith() is applicable for argument types: (java.lang.String) values: [.apk] Open Filespa

反正無論是哪一種錯誤,最後通過翻閱各個博客資料,和本身的嘗試,修改成下面的方案總算是能夠了。:.net

//自定義打包時apk名字
android.applicationVariants.all { variant ->
variant.outputs.all { output ->
def fileName
if (outputFileName != null && outputFileName.contains('.apk')) {
if (variant.buildType.name.equals('release')) {
//輸出示例: yilv-huawei-release.apk
fileName = "yilv-${variant.productFlavors[0].name}-${defaultConfig.versionName}-relese.apk"
} else if (variant.buildType.name.equals('debug')) {
fileName = "yilv-${variant.productFlavors[0].name}-${defaultConfig.versionName}-debug.apk"
}
outputFileName = fileName
}
}
}

//渠道
productFlavors {
develop {}
xiaomi {}
huawei {}

}
以上內容原文連接:https://blog.csdn.net/sunchaohui5741/article/details/80499547prototype

 

 

Intel HAXM is required to run this AVD.

 

7連接地址

https://jingyan.baidu.com/article/a3761b2be09f961576f9aab3.html

AndroidStudio Gradle 解決Error:All flavors must now belong to a named flavor dimension. Learn more at

連接地址:

https://blog.csdn.net/jabony/article/details/78932024

相關文章
相關標籤/搜索