weex转android踩坑之旅

  1. 编译代码

    • 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
  2. 使用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 } }
  3. 成功在真机上运行

    • 但是又出现 weex render error: -2013

      // 巨坑// 原因: js包有问题// 突然发现使用weex create 创建的项目引入vuex导致安卓报错// Exception: TypeError: undefined is not an object (evaluating 'this.$store.getters')// 求助大牛给我解答一下。。。

彻底弃坑,没有任何办法!!!!

更多相关文章

  1. Android代码中运行shell命令
  2. android中 代码实现截图功能(静态+动态视频)
  3. Android获取cpu和内存信息、网址的代码
  4. Android常用开源项目
  5. Android Studio 配置SVN 及 代码管理
  6. Android中拍照、图片、录音、视频和音频功能的方法和代码
  7. 准备一个rubymotion for android的实际项目
  8. 【Android休眠】之Android对PowerKey事件的处理(1)代码流程

随机推荐

  1. 如果Android真的收费了,你怎么看?
  2. Android开启网络adb调试
  3. Android(安卓)上的 Chrome 终于,即将,就要,
  4. Android(安卓)View相关-事件分发机制详解
  5. 使用surfaceView制作的拍照demo
  6. 关于Android系统的局域网广播的相关东东
  7. Android(安卓)关于dp dip sp px dpi dens
  8. Android(安卓)调用前置摄像头
  9. Android之Http通信——1.初识Http协议
  10. 【Android】Android中用代码复制文件的大