weex转android踩坑之旅
16lz
2022-03-10
weex转android踩坑之旅
-
编译代码
-
weex platform add android
-
weex build android
// 坑// 在build时报错,未找到ANDROID_HOME// 原因: 在~/.bash_profile 里将ANDROID_HOME暴露出来export ANDROID_HOME=/Users/yanglin/Library/Android/sdk // 个人路径不同,自行寻找sdk位置export PATH=$PATH:$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools
-
-
使用AS载入项目
-
修改build.gradle里的参数与当前环境配置的一样,具体配置可新建android项目查看
-
同时gradle文件替换
-
运行项目
// 坑/* 在AS 3.1.4中出现 1. Cannot set the value of read-only property ‘outputFile’ for ApkVariantOutputImpl_Decorated 2. Absolute path are not supported when setting an output file name*/// 这是原本的代码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) } }}// 修改后的代码applicationVariants.all { variant -> variant.outputs.all { output -> // 此处的each 变为 all def outputFile = output.outputFile if (outputFile != null && outputFile.name.equals('app-debug.apk')) { def fileName = outputFile.name.replace("app-debug.apk", "weex-app.apk") outputFileName = new File("../../../release/", fileName) // 此处变为相对路径 以及 output.outputFile 变为 outputFileName } }}// 再次运行后出现// Annotation processors must be explicitly declared now// 原因:版本问题// 在build.gradle中的defaultConfig中添加javaCompileOptions { annotationProcessorOptions { includeCompileClasspath = true } }
-
-
成功在真机上运行
-
但是又出现 weex render error: -2013
// 巨坑// 原因: js包有问题// 突然发现使用weex create 创建的项目引入vuex导致安卓报错// Exception: TypeError: undefined is not an object (evaluating 'this.$store.getters')// 求助大牛给我解答一下。。。
-
彻底弃坑,没有任何办法!!!!
更多相关文章
- android单元测试
- Android问题与解决
- Android(安卓)开源项目分类汇总
- 准备一个rubymotion for android的实际项目
- Android运行main方法后java虚拟机停止运行
- android GreenDao数据库框架学习(1)
- Android常用开源项目
- Android代码中运行shell命令
- Android(安卓)Studio 常见问题小结