I am trying to add datepicker plugin in my phonegap application.
I created phonegap application using the eclipse.
Steps :-
1) First i created the android project in eclipse
2) After i added the cordova.js and cordova.jar file to project and converted that project to the phonegap project.
Now project is working fine.
But when i am trying to add datepicker plugin to the application using "cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker"
I am getting error
Current working directory is not a Cordova-based project.
and when i am trying to add using "phonegap local plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker"
I am getting error
[Error: project directory could not be found]
[error] project directory could not be found
I dont know what problem i am getting here.
How can i add datepicker plugin manually using the eclipse.
My project structure is
Looks like you are trying with cordova version 1.6!!! It's too old, now cordova version is 3.5 as of today.
Here is the up to date documentation link for 3.5.
For starters, there are no more plugins.xml file in cordova.
You should create the project using command line cordova commands (introduced after 3.0 as far as I remember) so that folder structures and config.xml file (plugins and other configurations are in here), etc, are also formed. Doing it manually is almost impossible imho.
That's why you are getting error about working directory. I am confused and surprised that you are getting some error message at all.
do you add from command line ? if yes/ check the path, maybe you aren't in the project path,
if you were in the parent folder of the project root, the command not work.
for example:
c:\phonegap-projects\cordova add something
above command isn't work. you must be in the Cordova project path:
c:\phonegap-projects\MyApp\cordova add something
also you can check with this:
cordova plugin add https://github.com/VitaliiBlagodir/cordova-plugin-datepicker
hope be useful.
Related
Actually, I am very newbie about Cordova. I am building a push-notification function(OneSignal) on my cordova project.
First, I created the cordova app like this :
C:\>cordova create newGenNo15 io.newgen.newGenNo15 NewGenNo15
C:\newGenNo15>cordova platforms add android
C:\newGenNo15>cordova plugin add onesignal-cordova-plugin
And then, imported this to Eclipse.
File > Import > Android > Existing Android Code Into Workspace
But, I found errors in Java file.
I tried to solve this problem. But I couldn't make it.
Even I modified build.gradle file like adding classpath and compile, but I failed.
Do i have to solve this problem?
You will need to extract classes.jar file from the OneSignal .aar file. However I recommend just sticking with the standard Cordova build command instead of using Eclipse.
cordova build android --release
If you must use an Android project to add custom Java code I recommend using Android Studio over Eclipse. Google has stopped supporting Eclipse since the end of 2015.
I've created a phonegap project, with the CLI :
phonegap create Projectname
This works fine and I can start it without problems. Now I want to add this Barcodescanner : https://github.com/wildabeast/BarcodeScanner . I did this some time ago in my cordova based project like this:
cordova plugin add https://github.com/wildabeast/BarcodeScanner.git
Now I tried this with my Phonegap based project and it's obviously not working. But I've tried
phonegap local plugin add https://github.com/wildabeast/BarcodeScanner.git
too, which is not working too... Now is there one more possibility to add plugins, and thats plugman, but I don't get the plugman syntax at all ... Could you tell me at first why the phonegap command is not working and how to add the plugin with plugman. Thanks a lot.
The problem is the version from wildabeast is not compactible for phonegap version >3.2
Try adding this barcode scanner plugin,its specific to phonegap https://github.com/phonegap-build/BarcodeScanner
Install it using the syntax
phonegap local plugin add https://github.com/phonegap-build/BarcodeScanner
To get it to work I created a new project and copied my www to it and installed the plugin.It did not work for me in the old project.It might for you Iam not sure,just check
Why don't you try adding it manually? Just copy the Java sources to the src folder, the JavaScript (if any) to the assets folder, then manualy add a plugin element in the /res/xml/config file. Make sure to add permissions (like camera, file access, etc) to the manifest if needed.
I´m trying to get a gradle project running on my Mac, command line building works just fine. When I open the Project, all Android classes seem not to be found.
As a reference I also tried with this open source project (https://github.com/ligi/PassAndroid) of a friend of mine. Same problem there.
I´ve tried with the sample code (BasicMediaRouter), provided with the SDK, and I only had to change the android plugin version that it was referencing, so everything seemed normal.
Building and running also works, it´s just Android Studio that is broken.
I have the same problems with IntelliJ CE13.
Did you click 'sync project with gradle files'? (you can find it using cmd+shift+a and write it)
What happens if you position cursor on the red word (for example Bitmap) and click Alt+Enter?
It looks like you did not set up Android SDK path. You can set in up in FIle->Project Structure->SDK Path (or similar depending on what version of Android Studio you have)
What ended up helping is using the import Project function on the build.gradle file.
File -> Open on the build.gradle file led to the problems.
I am using the cordova test project to make an app with eclipse.
I followed the following steps (these are inside the README inside the cordova-3.3.0 /cordova-android folder).
Importing a Cordova Android Project into Eclipse
File > New > Project...
Android > Android Project
Create project from existing source (point to the generated app found in tmp/android)
Right click on libs/cordova.jar and add to build path
Right click on the project root: Run as > Run Configurations
Click on the Target tab and select Manual (this way you can choose the emulator or device to build to)
The projects i tried are:
cordova-3.3.0\cordova-android\framework
cordova-3.3.0\cordova-android\test
I keep getting the same kind of error:
Uncaught TypeError: Cannot read property 'DATA_URL' of undefined:68
I even tried full example code from :
http://docs.phonegap.com/en/edge/cordova_camera_camera.md.html#Camera
Try building the app (cordova build) again after installing the plugin. Let me know if that fixes it.
Sometimes just trying "phonegap build ios" or "phonegap build android" for a SECOND time is needed. At least that works for me.
It has something to do with the InAppBrowser plugin.
I'm also having same experience running "phonegap build android" twice to get it to compile.
From my own experience, it was InAppBrowser plugin that is causing this to happen.
I've done to create a phonegap 2.5.0 project template by following Getting Started with Android on Windows.
I'm using the ADT Bundle IDE from Get the Android SDK. After I setup new Android project from existing code, I get few errors that prevent building the project. I've solved AndroidManifest.xml, main.xml, strings.xml, config.xml. But I'm still getting the major error which is
Archive for required library: '~/libs/cordova-2.5.0.jar' in project 'xxx' cannot be read or is not a valid ZIP file
Does anyone facing this problem before?
To make things easy, you can create the project by using the command create provided with the phonegap package. Once created, you should be able to directly compile it without any errors.
To answwer your question, make sure you have cordova-2.5.0.jar in your libs. If not, add it using right click on project -> Build Path -> Add external archives. Then choose the jar.