科尔多瓦为Android级API 20构建 [英] Cordova build for android level api 20

查看:93
本文介绍了科尔多瓦为Android级API 20构建的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的android 4.4.4构建使用Angular2 + Ionic2(即Cordova 6)制作的应用。
我注意到android的4.4.4版本已改为api级别20,因此这是我已下载并安装的版本(也是api20 + android SDK Build Tools级别20)。在cordova中,我编辑了platform / android / project.properties和platform / android / CordovaLib / project.properties以构建为android-2O而不是默认的android-23 api。我还编辑了AndroidManifest.xml。



问题是当我尝试使用cordova构建android编译我的项目时,cordova执行了一些CordovaLib:instructions UP-TO-DATE和CordovaLib上的错误:compileDebugJavaWithJavac。。



根据错误报告,即:


platforms / android / CordovaLib / src / org / apache / cordova / CordovaClientCertRequest.java:25:
错误:找不到符号导入android.webkit.ClientCertRequest;
^符号:类ClientCertRequest位置:包android.webkit


在所有错误报告的末尾,它还说:


您可能没有所需的环境或操作系统来构建此项目
错误:命令的错误代码1:
平台/带有args的android / gradlew:
cdvBuildDebug,-b,/ Users / thomas / Documents / www / MyProject / platforms / android / build.gradle,-Dorg.gradle.daemon = true,-Pandroid.useDeprecatedNdk = true


所以我来这里寻求帮助,因为我不知道Cordova和android-SDK有什么问题。 。



谢谢大家的帮助;)



再见!

解决方案

为Android构建时,有 targetSdkVersion minSdkVersion



targetSdkVersion 表示将使用该API的最高版本来编译专业版

minSdkVersion 表示必须以克为单位,而不是非Android版本的Android。最低版本的android设备必须与您的程序兼容。



如果您将 targetSdkVersion 降级,仅限于较旧的函数,并且如果您的程序使用较新的函数,它将无法编译(我认为如果尝试使用API​​ 20编译为API 23设计的Cordova版本,就会发生这种情况。)



默认情况下,Cordova(至少对于cordova-android 5.1版而言)使用targetSdkVersion 23和 minSdkVersion 14,这意味着程序应在设备上运行运行Android Ice Cream Sandwich(4.0)或更高版本。



对于您来说,您要做的就是安装SDK 23,不要碰任何东西来尝试更改目标SDK。


I am trying to build an app made with Angular2 + Ionic2 (ie. Cordova 6) for my android 4.4.4. I have noticed the version 4.4.4 of android was reffered to the api level 20, so this is the version I have downloaded and installed (api20 + android SDK Build Tools level 20 too). In cordova I have edited the platforms/android/project.properties and platforms/android/CordovaLib/project.properties to build to android-2O instead of the default android-23 api. I have also edited the AndroidManifest.xml.

The issue comes when I try to compile my project with cordova build android, cordova executes some CordovaLib:instructions UP-TO-DATE and bug on CordovaLib:compileDebugJavaWithJavac..

According to the error report which is :

platforms/android/CordovaLib/src/org/apache/cordova/CordovaClientCertRequest.java:25: error: cannot find symbol import android.webkit.ClientCertRequest; ^ symbol: class ClientCertRequest location: package android.webkit

At the end of all the error report it also says :

You may not have the required environment or OS to build this project Error: Error code 1 for command: platforms/android/gradlew with args: cdvBuildDebug,-b,/Users/thomas/Documents/www/MyProject/platforms/android/build.gradle,-Dorg.gradle.daemon=true,-Pandroid.useDeprecatedNdk=true

So I come here to ask for help, because I have no idea what is wrong with Cordova and android-SDK...

Thank you to everyone who helps ;)

Bye !

解决方案

When you build for Android there is targetSdkVersion and minSdkVersion.

targetSdkVersion indicates wich version of the API will be used to compile the program, not wich version of Android must be on the device the program will be run on.

minSdkVersion indicates the minimum version of android a device must have to be compatible with your program.

If you downgrade the targetSdkVersion, you are limited to older functions and if your program uses the newer functions it will fail to compile (I think it's what happens if you try to compile a Cordova version designed for API 23 with API 20).

By default Cordova (at least for the version 5.1 of cordova-android) uses the targetSdkVersion 23 and the minSdkVersion 14, which means programs should work on devices runing Android Ice Cream Sandwich (4.0) or newer.

In your case, all you have to do is install SDK 23 and don't touch anything to try to change the target SDK.

这篇关于科尔多瓦为Android级API 20构建的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆