vue android studio,2.搭配Android studio

1. **生成Android**

在项目中的命令行输入

```

weex platform add android

```

在andriod studio中打开模拟器,然后运行以下命令

```

weex run android

```

```

```

>[danger]执行该步骤的前提是安装Android studio,安装过JDK,配置完环境变量

****

****

2. **使用Android studio打开**

可见在当前weex项目中的platforms文件夹下生成一个Android项目

使用Android studio打开该文件

![](https://box.kancloud.cn/100fcd3afe8b1d09eb8a73d30714ed64_527x528.png)

****

3. **等待一系列安装乱七八糟的之后,显示如下就可以正常运行**

![](https://box.kancloud.cn/abf689cce34e3d0224268cb210cf68a2_1262x112.png)

****

**当然它很有可能不会这么顺利,它会报错报错报错!!!😡来了,错误汇总!!!**

>[danger]1. no toolchains巴拉巴拉 少文件七了八的

移步这位大哥@[CodeForCoffee](https://blog.csdn.net/qq_24118527/article/details/82867864)

>[success]2. ERROR: The versions of the Android Gradle plugin and Gradle are not compatible. Please do one of the

走@[lvxiangan](https://blog.csdn.net/lvxiangan/article/details/78953921)

![](https://box.kancloud.cn/8eee9e12ae2afb0593ad374273e97c8d_630x312.png)

>[warning]3. Cannot set the value of read-only property 'outputFile' for ApkVariantOutputImpl_Decorated……

移步另一个大哥@[Paweł Nadolski](https://stackoverflow.com/questions/44239235/android-gradle-3-0-0-alpha2-plugin-cannot-set-the-value-of-read-only-property)

![](https://box.kancloud.cn/4cd686d0b2fc02583d56e1a7d2b94d4a_741x259.png)

```

android.applicationVariants.all { variant ->

variant.outputs.all {

outputFileName = "${variant.name}-${variant.versionName}.apk"

}

}

```

>[info]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)

[请走](https://www.jianshu.com/p/601daa5aed8d)

![](https://box.kancloud.cn/6d1afee6dea5e7a12224288818fc3ff6_711x183.png)

```

javaCompileOptions {

annotationProcessorOptions {

includeCompileClasspath = true

}

}

```

****

****

4. **在手机上打开开发者模式**

百度一下

[oppo手机](https://jingyan.baidu.com/article/91f5db1b1d51be1c7e05e35f.html)

****

5. **Android studio打包该文件**

![](https://box.kancloud.cn/d916e98d78e064ccd055a385d3c07aaf_534x454.png)

在该文件目录下的app-->build-->outputs-->apk-->debug下能看到该文件

发送至手机,安装,打开,可以看到hello world

****

**到此,初次血泪之旅结束,拜拜!**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值