I've got a problem concerning cordova. This is a simple topic about the installation of cordova, the creation of a project and the addition of plugins. Actually I thought that everything was ok until I try to add plugins in my project. The methods associated with the cordova plugins are not recognized at the execution of the program... I express myself:
I've correctly installed nodeJS, correctly set the environment variables etc...
Then I install cordova by typing: npm install -g cordova
Everything's ok at this moment.
After that, I try to create a new project: cordova create Test com.example.test Test
for example
For now, compared to the tutorial video here at 9:37, I have:
Creating a new cordova project with name "Test" and id "com.example.text"
at location [...]"
But I don't have the to last lines of the video:
Downloading cordova library for www...
Downloading complete
So there's already something weird here...
I specify an android project by typing:
cordova platforms add android
And after that, the terminal display the following lines:
Creating android project...
Creating Cordova project for the Android platform:
Path: platforms\android
Package: com.example.test
Name: test
Android target: android-19
Copying template files...
Project successfully created
but it seems that in the same video as before at 10:27, a lot of things should happen that it doesn't seem to happen to me...
The project is nevertheless "correctly" created, despite of these elements BUT:
the libs
folder is empty (and I think this is the problem...)
Ok, after that I try to add a plugin, I type: cordova plugin add org.apache.cordova.device-orientation
to get the compass plugin.
The AndroidManifest.xml
and res\xml\config.xml
are correctly modified to set the features (in build.xml) and the permissions (in AndroidManifest.xml), then I don't think this is here my problem...
But for a trivial code like:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<title>Hello World</title>
</head>
<body>
<div class="app">
<h1>Apache Cordova</h1>
<div id="deviceready" class="blink">
<p class="event listening">Connecting to Device</p>
<p class="event received">Device is Ready</p>
</div>
</div>
<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script>
if(navigator.compass)
alert("ok");
else
alert("not supported");
</script>
</body>
</html>
I've got an alert saying "not supported" (navigator.compass is undefined)
It seems that this problem persists for the other plugins of cordova; I can't use their associated method... except for one: navigator.geolocation; I don't know why but this is the only thing that is recognized when I use it.
Well, I don't know what to do, I've seen some other topics on "jar file missing" especially this one but I'm not sure this is the real problem. But if it is I don't understand where to place the generated jar file in the project...(??)
Anyway, if you have ever faced this kind of situation, I really would appreciate because it makes 3 complete days now that I try to fix this problem.
Note: This is maybe not necessary to say it but I try to entirely code my project in javascript (to produce an application applicable on many platforms not only android [here it is just to test]). If there are permissions to add or some little things like that it's ok, but I prefer to limit the android specifications.
Waiting for your answers, thank you for all