weex踩坑之【安卓打包】

環(huán)境搭建準(zhǔn)備:

JDK 1.7以上
SDK
Android Studio
...

問(wèn)題點(diǎn)1: Sync Project with Gradle Files時(shí)報(bào)錯(cuò):

報(bào)錯(cuò)信息
Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated...
這是由于gradle 3.0 以后 不支持這樣的寫(xiě)法了,更改如下:

原代碼

applicationVariants.all { variant ->
        variant.outputs.each { output ->
            def outputFile = output.outputFile
            if (outputFile != null && outputFile.name.equals('app-debug.apk')) {
                def fileName = outputFile.name.replace("app-debug.apk", "weex-app.apk")
                output.outputFile = new File(outputFile.parent, fileName)
            }
        }
    }

更改為

android.applicationVariants.all { variant ->
        variant.outputs.all {
            outputFileName = "${defaultConfig.versionName}.apk"
        }
    }

問(wèn)題點(diǎn)2:同樣是版本問(wèn)題導(dǎo)致的

報(bào)錯(cuò)信息

Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.

解決辦法: 將‘compile’全部改為‘implementation’就行。

問(wèn)題點(diǎn)3:發(fā)現(xiàn)各種依賴包無(wú)法下載成功

解決辦法: gradle.properties文件將代理代碼注釋掉

問(wèn)題點(diǎn)4:AVD manager 添加設(shè)備時(shí)需要下載intel haxm

下載haxm安裝包后,將intelhaxm-android.exe 文件進(jìn)行解壓


image.png

解壓后:運(yùn)行setup.exe


image.png

【注意】在運(yùn)行setup.exe之前,先確認(rèn)一下當(dāng)前電腦的BIOS的VT有沒(méi)有打開(kāi),需要打開(kāi)的。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容