1.首先装个weexpack

使用npm build [web|ios|android]这样的命令总是会报错no such file or directory, open '***.package.json',也找不到相关文档说明。所以还是装个weexpack来用的好。
npm install weexpack -g
当然也得安装好android的开发环境。

2.cd进项目目录然后安装依赖

npm install

3. 运行或打包

$ weexpack build android

报错

Error:Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated{apkData=Main{type=MAIN, fullName=debug, filters=[]}} of type com.android.build.gradle.internal.api.ApkVariantOutputImpl.

这是由于升级Android studio3以后,buide.gradle里老的写法不顶用了,要改成如下:

    android.applicationVariants.all { variant ->        variant.outputs.all {            outputFileName = "weex-app.apk"        }    }

4.再次运行及打包

再次报错误

Error:Execution failed for task ':app:javaPreCompileDebug'.Annotation processors must be explicitly declared now.  The following dependencies on the compile classpath are found to contain annotation processor.  Please add them to the annotationProcessor configuration.- weexplugin-processor-1.3.jar (com.taobao.android:weexplugin-processor:1.3)Alternatively, set android.defaultConfig.javaCompileOptions.annotationProcessorOptions.includeCompileClasspath = true to continue with previous behavior.  Note that this option is deprecated and will be removed in the future.See https://developer.android.com/r/tools/annotation-processor-error-message.html for more details.

需要在build.gradle文件的defaultConfig中添加相关设置

      javaCompileOptions {            annotationProcessorOptions {                includeCompileClasspath = true            }        }

5. Will start Android app 或 No android devices found

到这里卡住没有动静了。一般是adb没连上。然而并不知具体怎么了。最后还是在Android studio里打开项目build了事。

更多相关文章

  1. Android Studio - 第四十六期 不会ANR的轮播写法
  2. android中app升级的两种常用写法
  3. android按钮监听器的写法
  4. android View长按事件简单写法
  5. Android中点击事件的四种写法
  6. 8.1、Android中为Intent附加数据的两种写法
  7. 点击事件XML里的写法
  8. Android横竖屏的写法、及savedInstanceState的使用
  9. android ViewHolder模式超简洁写法

随机推荐

  1. sql server字符串非空判断实现方法
  2. sqlldr装载数据实现代码
  3. Sql Server触发器的使用
  4. jdbc连接sql server数据库问题分析
  5. SQL Server高可用的常见问题分析
  6. sql处理数据库锁的存储过程分享
  7. SQLSERVER 本地查询更新操作远程数据库的
  8. sql 查询记录数结果集某个区间内记录
  9. sql server 表结构修改方法
  10. MSSQL数据库排序规则如何更改