How to add a library resource to a Cordova project?

When writing multiple cordova plugins, source / header files, iOS libraries and Android Jar from some resource SDK files can be added to the Cordova plugin.

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

There is some workaround to add the library project (including the bank and the resource) to the created Cordova project, but such a workaround cannot be used when creating the Cordova application in a cloud service such as Intel XDK or PhoneGap Build.

Is it possible to add an SDK resource and create R.java in the SDK namespace? If so, how?

+6
source share
1 answer

It is a pity that the questions have not yet been answered.

The good news is that after many weeks of work, I found out a solution from another project: https://github.com/MobileChromeApps/google-play-services

A new feature has been added to the Cordova plugin.xml to support the android subproject, which will be added to the Cordova project. Here is an example from the above project,

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

For iOS, this is very similar, add a framework similar to this:

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

Then the CLI cordova team will know how to add the entire folder to the Cordova project and add as a subproject project for the eclipse project and add the framework to the Xcode project file.

But, stay informed!

Although cordova's CLI interface supports this new feature, Intel XDK does not yet support it !!! At the time of this writing (November 15, 2014), he was still using cordova v3.3.

Result:

If you are writing a plugin and using the plugin "com.google.playservices" as a dependency,

  • When using CLI cordova, you can easily create a plugin.
  • If you are using Intel XDK, the plugin cannot be downloaded.

Then, how to fix this for Intel XDK?

Answer: specify the exact version number of the dependency in your plugin.xml file, for example:

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

We hope that the above information is useful for those who are faced with the same problem.

Greetings.

+12
source

Source: https://habr.com/ru/post/976055/


All Articles