weex踩坑之【安卓打包】

环境搭建准备:

JDK 1.7以上
SDK
Android Studio
...

问题点1: Sync Project with Gradle Files时报错:

报错信息
Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated...
这是由于gradle 3.0 以后 不支持这样的写法了,更改如下:

原代码

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"
        }
    }

问题点2:同样是版本问题导致的

报错信息

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

解决办法: 将‘compile’全部改为‘implementation’就行。

问题点3:发现各种依赖包无法下载成功

解决办法: gradle.properties文件将代理代码注释掉

问题点4:AVD manager 添加设备时需要下载intel haxm

下载haxm安装包后,将intelhaxm-android.exe 文件进行解压


image.png

解压后:运行setup.exe


image.png

【注意】在运行setup.exe之前,先确认一下当前电脑的BIOS的VT有没有打开,需要打开的。

©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容