记录一个cordova+vue打包生成apk文件的问题

说一下我碰到的问题,我自己创建的vue项目利用cordova打包是没有问题的,可以生成akp文件,但是公司的项目按照之前的办法始终不行,报如下错误:

1 error; aborting
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException: java.lang.RuntimeException: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: java.util.concurrent.ExecutionException: com.android.ide.common.process.ProcessException: Return code 1 for dex process

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

cordova文件里面打开cmd 输入命令:cordova requirements显示:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: not installed
Android SDK not found. Make sure that it is installed. If it is not at the default location, set the ANDROID_HOME environment variable.
Cannot read property 'version' of undefined

这里说一下,我的androidSDK是已经安装了的,不然之前的项目也不能打包成功,自己的项目里输入:cordova requirements显示:

Requirements check results for android:
Java JDK: installed 1.8.0
Android SDK: installed true
Android target: installed android-28,android-25,android-24,android-23
Gradle: installed C:\Program Files\Gradle\gradle-5.6.3\bin\gradle

然后就在这个问题上困扰了很久,尝试过降低android版本,反正就是不行。
最后的解决办法就是单独把公司醒目的android文件夹拎出来在android Studio 上面运行了一下,之后再cordova目录下载输入命令:cordova run android 就打包成功生成apk文件了

Total time: 3.179 secs
Built the following apk(s):
        C:/file/demo/yz_science_bar/frontend/learn-cordova/platforms/android/build/outputs/apk/android-debug.apk

至此算是解决了:不过当我再次输入cordova requirements命令查看的时候还是和上面一样的提示,不过apk文件已经生成了,就不深究了,(反正也没有搞懂~~~~~~~~)。QAQ

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值