如何图书馆资源添加到科尔多瓦项目? [英] How to add Library Resource to Cordova Project?

查看:100
本文介绍了如何图书馆资源添加到科尔多瓦项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一些SDK,资源文件书面方式几科尔多瓦插件,源/头文件,库的iOS和Android罐,都可以加入到科尔多瓦插件。

When writting a few cordova plugins, source/header files, iOS libraries and Android Jar from some SDK, resource files, can all be added to Cordova plugin.

在使用谷歌播放-services.jar,库项目包含一些资源文件,如果添加的资源,将在应用程序的命名空间,而不是SDK命名空间产生R.java。

When using google-play-services.jar, the library project contains some resource files, If the resources added, will generated R.java in app namespace, not the SDK namespace.

有一些变通方法来添加库项目(包括JAR和资源)到科尔多瓦创建的项目,但如果像英特尔XDK或PhoneGap的构建。

There is some workaround to add the library project (including jar and resource) into created Cordova project, but such workaround cannot be used if build Cordova app in cloud service like Intel XDK or PhoneGap Build.

是否可以添加SDK资源和SDK的命名空间产生R.java?如果是的话,怎么样?

Is it possible to add SDK resource and generate R.java in SDK namespace? If yes, how?

推荐答案

这是一个遗憾的问题还没有回答。

It's a pity the questions is not answered yet.

好消息是,挣扎了两周之后,我碰巧得知从另一个项目的解决方案: HTTPS ://github.com/MobileChromeApps/google-play-services

Good news is, after struggled for weeks, I happen to learn the solution from another project: https://github.com/MobileChromeApps/google-play-services

一个新的功能被添加到plugin.xml中科尔多瓦,支持Android子项目被添加到科尔多瓦项目。这里是从上面的项目的例子中,

A new feature is added to Cordova plugin.xml, to support android sub-project to be added to Cordova project. Here is the example from the project above,

<framework src="libs/google-play-services_lib" custom="true" />

对于iOS,这是相当类似的,添加了一个框架是这样的:

For iOS, it's quite similar, add a framework like this:

<framework src="src/ios/MobFox.framework" custom="true"/>

然后科尔多瓦CLI会知道如何对整个文件夹添加到科尔多瓦项目中,并添加子项目到eclipse项目,并添加框架于X code项目文件。

Then cordova CLI will know how to add the whole folder to Cordova project, and add as sub project to eclipse project, and add framework to Xcode project file.

不过,请注意!

虽然科尔多瓦CLI支持这一新功能,英特尔XDK不支持它尚未!在写这篇文章(2014年11月15日)的时候,它仍然使用科尔多瓦V3.3。

Though cordova CLI support this new feature, Intel XDK does not support it yet !!! At the time of writing this post (Nov 15, 2014), it still use cordova v3.3.

的结果是:

如果你写一个插件,并使用插件com.google.playservices作为一个依赖,

If you write a plugin, and use the plugin "com.google.playservices" as a dependency,


  • 当使用科尔多瓦CLI时,插件可以没有任何问题地建造。

  • 如果使用英特尔XDK,你插件无法加载。

那么,如何解决它为英特尔XDK?

Then, how to fix it for Intel XDK?

答案是:指定在plugin.xml依赖的确切版本号,这样的:

The answer is: specify the exact version number of the dependency in your plugin.xml, like this:

<dependency id="com.google.playservices@19.0.0"/>

希望以上信息对别人谁遇到同样的问题是有用的。

Hope the above information is useful to someone who encountered the same problem.

干杯。

这篇关于如何图书馆资源添加到科尔多瓦项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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