问题描述
当我尝试使用以下命令创建一个phonegap项目:
When I try to create a phonegap project with the following command ;
phonegap create myapp --id com.apps.myapp --name myapp
我收到以下错误:
Manifest merger failed : uses-sdk:minSdkVersion 8 cannot be smaller version
10 declared in library projectName\platforms\android\ build\ intermediates\exploded\aar\android\cordovaLib\unspecified\debug\AndroidManifest.xml .
Suggestion : use
tools.overrideLibrary = "org.apache.cordova" to force usage.
我使用这样的命令很好,但事情发生后,我安装Android Studio(与Gradle)并将cordova版本升级到5.0.0-0-27.1。有什么办法摆脱这个Gradle吗?我认为因为Gradle及其配置,phonegap create命令以不同的方式开始工作。
I used to work with such commands fine but something happened right after I installed Android Studio (with Gradle) and upgraded cordova version to 5.0.0-0-27.1. Is there any way of getting rid of this Gradle ? I think because of Gradle and its configuration , phonegap create command started to work in a different way.
或 Gradle一直在那里,还有其他东西搞乱了我的配置。如果没有,请帮助我删除关于Gradle的一切,并正常工作。
Or Gradle has always been there and something else is messing up my configuration. If not, please help me remove everything about Gradle and work properly.
毕竟(如果删除Gradle没有意义),我如何指定minSDK版本在我创建项目时通过命令行? 。
After all (if removing Gradle does not make sense), how am I going to specify the minSDK version by the command line while I create the project ? .
推荐答案
不知道为什么最新版本导致这样的问题,但是当我得到cordova和phonegap版本回到3.x版本,问题消失了。
Not sure why the latest version caused to such problem but, when I get the cordova and phonegap version back to 3.x versions, the problem disappeared.
检查可用的版本;
npm view phonegap versions
卸载当前版本
npm uninstall -g phonegap
要安装特定的prev。版本
To install a specific prev. version
npm install -g [email protected]
您也可以对cordova框架使用相同的命令。
You can use the same commands for cordova framework as well.
替代解决方案不需要安装旧版本(如果您之前有一个phonegap项目,并且在升级您的框架版本后出现问题)
Alternate solution without needing to install older versions ! (If you had a phonegap project before and you end up having problems after upgrading your framework versions)
安装最新版本的Cordova和Phonegap,然后使用以下命令创建项目:
Install the latest versions of both Cordova and Phonegap, then create your project with the following command ;
cordova create projectName com.example.projectName projectName
然后从之前创建的项目之一以及用于运行phonegap build命令的没有错误的项目中复制.cordova文件夹。
Then copy the .cordova folder from one of the projects that you created before, and for what you used to run "phonegap build" command with no error. Then paste it into your new project's main path where www folder is also located.
现在你可以在没有构建失败的情况下运行phonegap命令了。
Here you go, now you are able to run phonegap commands without build failure.
这篇关于Phonegap创建和生成命令由于minSDK版本而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!