cordova phonegap-如何使用android API级别21 [英] cordova phonegap - How to use android API level 21

查看:139
本文介绍了cordova phonegap-如何使用android API级别21的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,我分叉了推送通知插件( https://github.com/alexislg2/PushPlugin )并将其添加到我的项目中.

Hey I forked the push notification plugin (https://github.com/alexislg2/PushPlugin) and added it to my project.

该项目将无法使用cordova build进行编译,因为我遇到了error: cannot find symbol错误.

The project won't compile with cordova build because I have a error: cannot find symbol error.

原因是我在Android SDK 21插件Notification.setCategory()方法中使用了

The reason is that I use in the plugin Notification.setCategory() method which is Android SDK 21.

如何强制Cordova使用API​​级别21进行编译?

How to force cordova to compile using API level 21?

我安装了android 21 sdk构建工具+在config.xml中设置了<preference name="android-targetSdkVersion" value="21" />

I installed the android 21 sdk build tools + I set <preference name="android-targetSdkVersion" value="21" /> in my config.xml

但是cordova一直在尝试使用android 19进行编译.这是怎么回事?

But cordova keeps trying to compile with android 19. What is wrong?

谢谢

推荐答案

这是Cordova更新到android-21的进度,android平台插件v4.0将支持棒棒糖: https://issues.apache.org/jira/browse/CB-8026

This is the progress of Cordova updating to android-21, android platform plugin v4.0 will support lollipop: https://issues.apache.org/jira/browse/CB-8026

存在有关cookie和临时解决方法的问题: http://tol8.blogspot.ca/2014/11/fixed -apps-cordovaphonegap-targeting.html

There is an issue about cookie and a temporary workaround: http://tol8.blogspot.ca/2014/11/fixed-apps-cordovaphonegap-targeting.html

我建议等待下一个版本,看起来3.7.1也更新了目标api级别.

I would suggest waiting for the next version, looks like 3.7.1 also updated the target api level.

我没有在项目中使用Cookie相关功能,因此我在

I am not using cookie related feature in my project, so I just replaced "android-19" with "android-21" in

platforms/android/CordovaLib/project.properties

并在config.xml中添加首选项

And adds preference in config.xml

<platform name="android">
    <preference name="android-targetSdkVersion" value="21" />
</platform>

另一种解决方法(但很丑)是更改android插件代码的系统缓存:

Another workaround (but ugly) is change the system cache of android plugin code:

~/.cordova/lib/npm_cache/cordova-android/3.6.4/package/framework/project.properties

----更新----

---- Update ----

Cordova 4.2.1(当前为4.1.2)中将添加更新平台插件的更好方法: https://issues.apache.org/jira/browse/CB-8239

A better way of updating platform plugin will added in Cordova 4.2.1 (currently 4.1.2): https://issues.apache.org/jira/browse/CB-8239

$ cordova platform add <URL>

这篇关于cordova phonegap-如何使用android API级别21的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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