先看官网https://weex-project.io/cn/guide/integrate-to-your-app.html
对于没有接触过安卓,没有安卓安卓环境的小伙伴刚学习weex的时候都想先打包一个android的app,但苦于官网以及网上怎么百度都是有安卓基础有安卓环境为前提的条件下来写的文章,这里就满足小伙伴们这个好奇心,从安装安卓环境到打包weex安卓apk。
在weex入门基础上
1、安装JDK
JDK下载地址https://www.oracle.com/technetwork/java/javase/downloads/index.html
配置环境变量参考https://blog.csdn.net/u012934325/article/details/73441617/
window+R输入cmd打开命令行窗口输入java -version
检查是否安装成功
2、安装android SDK下载地址 http://www.androiddevtools.cn/
配置环境变量参考
https://blog.csdn.net/qq_36577136/article/details/80632674
https://www.cnblogs.com/goldlong/p/8109283.html
https://www.cnblogs.com/nebie/p/9145627.html
https://blog.csdn.net/Xushuai0616/article/details/55802725
https://blog.csdn.net/qq_42208273/article/details/80314940
https://www.cnblogs.com/kangjianwei101/p/5621238.html
- 如果SDK manager.exe出现闪退等可能是jdk版本太低或者环境变量配置错误的原因
- SDK manager.exe双击打开后安装android选一个版本就行,安装错误Missing SDK Platform Android, API,emem,换一个anndroid版本或者设置一下面板上的tools->options
window+R输入cmd打开命令行窗口输入adb version
检查是否安装成功
安装的过程并不顺利,不过结果只有一个,铛铛铛,安装成功

安卓虚拟机准备就绪

3、安装Android Studio安卓IDE:http://www.androiddevtools.cn/
https://blog.csdn.net/samt007/article/details/78701348
默认情况下 weex create 命令并不初始化 iOS 和 Android 项目,你可以通过执行 weex platform add 来添加特定平台的项目。也可全局安装使用weexpack,cnpm install -g weexpack
weex platform add ios
weex platform add android
直接打包https://www.jianshu.com/p/674efb2468e4
weexpack build android
报错没有接受许可协议

解决接受许可协议看这里https://blog.csdn.net/qq_22780533/article/details/79753110
再次安装报错,缺少sdk 26,缺少那我就安装,重新到SDK Manage.exe安装api26版本的
最后BUILD SUCCESSFUL

把打包成功的啊apk发到手机上安装platforms->android->app->build->outputs->apk找到安装包
接着在线调试
weexpack run android
报错

weex run android 报 Error: No android devices found. 错误,解决方法直接在Android Studio里打开 项目\platforms\android目录,所有提示要安装的统统安装,然后用Android Studio里的run和build来调试和打包

网友评论