0

I started with cordova and I have some small problems. I've created an android application. I have installed java, android SDK , Apache Ant and Apache Ant.

I have added android with cordova add platforms android and builded correctly.

1 - When I use cordova run android I get the following error:

an error occured while running the android project . Buildfile : ...Demo \ platforms \ android \ build.xml . ERROR : Failed to install apk to device

I think this is due to the fact that my application is not in debug mode. How to set the debug mode? (' cordova emulate android ' works and launches the emulator )

2 - When I want to load a project in eclipse . (New project - > Android Project from Existing Code) I have the error:

Invalid project description Reason : . Invalid project description

How to overcome this error ?

3 - I want to install external plugins, eg - https://github.com/ClickInnovate/CordovaPhoneGapPlugins/tree/master/Android/SocialMessage - https://github.com/phonegap/phonegap-plugins/tree/master/Android/StatusBarNotification It is said that to copy the java files in the src folder , but, I copy the java files in the original project or one that is build ( in plateform directorie )

tshepang
  • 12,111
  • 21
  • 91
  • 136
jeremy.raf
  • 133
  • 2
  • 12

1 Answers1

2
  1. If you run cordova run android -d, you will see additional debugging information printed to the console which should hopefully help you narrow down the problem. I've never seen that error you are getting, but to set your device up for debugging you should follow these steps. Some steps may be different or unneeded based on your Android device and version:

    1. Settings --> Click on "About Tablet" --> Click on Build Number 7 times to activate "Developer mode"
    2. Settings --> Developer options --> USB Debugging (make sure it is checked)
    3. Settings -->Security-->Unknown Sources` (make sure it is checked)
    4. Storage --> Click the drop down on the top right --> USB computer connection --> Make sure "Camera (PTP)" is checked
  2. Please ensure that you are following the Android platform guide. If you are getting "Invalid project description" you might just need to type in a project description in one of the boxes in Eclipse? Another thing, make sure you are doing Import-->Android-->Android Project from Existing Code. Finally, it sounds like this might be a goofy Eclipse environment issue, here is another question on SO about this problem.

  3. The plugins that you listed are old, they were made before Cordova 3.X came out. In 3.X, a new plugin management system using Cordova CLI and Plugman is used to install plugins - the only problem is that the plugins need to be updated to use this new format. You could look around to see if somebody has updated those plugins (look on the Fork page on GitHub is one good way.) Otherwise if you can't find an updated plugin, you could try to update the plugin yourself following the upgrade guides on the doc website. To answer your question, the java files would be need to eventually be copied into the build folder. In 3.X, the files are stored in the /plugins/ folder, then copied to the /platforms/android/ folder when you run cordova prepare, and are built into the cordova.jar when you do cordova compile. You can also read about how to install plugins with just plugman.

Community
  • 1
  • 1
MBillau
  • 5,366
  • 2
  • 28
  • 29