Cordova (Phonegap) build undo my code changes in Eclipse - eclipse

Once I create my Phonegap project through the CLI with:
cordova create hello com.example.hello "HelloWorld"
add the android platform and import the project to my Eclipse, every time I run a cordova build android command, it undo/reverts the code that I changed on Eclipse, looks like it always gets reverted to the original project structure created by Cordova CLI, maybe I missed something in the documentation... any ideas?
UPDATE
Ok.. So the plan will be, I will develop my app using the root files, i.e., within hello/www/* (instead of the files within hello/platforms/android/assets/www/*) because Phonegap will override any changes to the ones for specific platforms as part of its build process. My development workflow then involves TextMate to edit HMTL/CSS/JS and then running cordova prepare under the project's folder in order to update the files in my Eclipse project.
Anyway.. just sharing my solution workaround to the cumbersome development process for Phonegap + Android because, IMHO, the documentation around this technology sucks...

Related

How to add a new flutter project as a IntelliJ module in a larger project

I have a single INTELLIJ project, with 4 java modules and 4 python modules, each is also pretty much a separate sub-project in gradle. Now, in an isolated module in the same project I want a flutter app.
Eventually I might want to make custom gradle tasks to run flutter as a subproject so that I can build all from gradle but that is way down the road. Right now I'm trying to get the intelliJ flutter plugin to work with the flutter project as a module (instead of the base folder, one level down, app/flutterApp/[Anything Flutter Needs]).
The dream is to have these 9 projects in the same folder, master project, git and build pipeline as a single set without losing functionality... if it can happen without touching android studio even better.
Instructions (So far):
File - new - module, then select flutter.
Add the module in project structure so it's inline with the others (use dot notation to signify module groups/folders).
Add "Dart SDK", "Dart Packages" and "Flutter Plugins" Dependencies in the said tab of the module.
Set the flutter sdk location (File - Settings - Languages - Flutter)
RUN main.dart: This allows the flutter plugin to recognize it; sadly after figuring the rest out, this is what thwarted the effort.

How build and run samples

In the futter/examples folder there are lot examples of applications. How to build and run them on Android for instance? I tried to open projects using the IntelliJ IDEA framework, but I did not succeed. I.e. the project is being opened, but it's impossible to build it because of undecidable dependences.
run
flutter update-packages
then in the directory of the example
flutter run

Gradle: "Refresh All" removes linked project in Java build Path

I am using libgdx to make a ios game with RoboVM. I am using the latest versions of LibGDX, RoboVM and my Eclipse is up to date.
Recently I have been trying to add Google Analytics thanks to the Robovm bindings.
I have manually imported the analytics project in Eclipse:
with File -> Import -> Gradle project
Everyting works fine, I can import and use the classes in my ios project.
But then if I right click my ios project -> Gradle -> refresh all, the build is succesful but it removes the analytics project from the java build path. As a result, when I try to compile my ios project from a terminal with a command line, it doesn't compile since it doesn't fine the analytics classes. I am using "./gradlew -Probovm.device.name=myiPhone launchIOSDevice --stacktrace"
I guess there is a setting or property in Gradle or Robovm that I should change, anybody has an idea?
Answering to myself, it might help others... I ended up creating my own jar from the analytics project, and added it as a library in a separate folder. As described here: https://github.com/BlueRiverInteractive/robovm-ios-bindings/blob/master/README.md
This way every new Gradle build correctly links it to my ios project.

Access Cordova CLI in local Intel-XDK

Intel-XDK uses third party Cordova plugins only at build time. Is there a way to implement a third party plugin using Cordova CLI in my local Intel-XDK environment? In other words, can I access the internal Intel-XDK Cordova server in some way?
EDIT (7 Aug 2015): With our EA release local plugins no longer need to be placed inside your source directory (typically www inside your project directory). The Intel XDK EA release manages plugins in a way that is consistent with Cordova CLI. This CLI-compatible plugin management scheme will become part of the mainstream release in the very near future.
Original Post:
You cannot directly access the XDK build server's CLI. However, you can reference a plugin locally (that is, you can submit a plugin that is located on your local disk drive). Unfortunately, you have to locate the plugin inside your www "source" directory, I hope to see that changed in a future revision of the product; this is not where a local CLI would place the plugin...
Placing the plugin into your www directory, and then referencing it using the "import local plugin" on the Projects tab (find the "Plugins and Permission" and then the "Third-Party Plugins" section) allows you to customize that plugin before it gets submitted to the build service. For example, assume you need to change the contennts of the plugin.xml file or change a plist or manifest file that is part of the plugin, you could do that in the local copy and those changes would be part of this "local third-party plugin" that is submitted to the build server with your app when the build server runs.
In essence, the build server does a plugin add on a copy of the plugin that got submitted along with your project when you use the "import local plugin" feature. A copy of your local plugin gets sent with your app source to the build server and, before the build happens, the build server's CLI performs a plugin add with that plugin, so the changes you implemented locally will be included in the plugin when it is built by the build server. Make sense? :)
There are also some useful things you can do with the intelxdk.config.additions.xml file regarding plugins. See these doc pages for some details:
https://software.intel.com/en-us/html5/xdkdocs#517453
https://software.intel.com/en-us/html5/articles/using-the-cordova-for-android-ios-etc-build-option
The checkmarked plugins on the Project tab refer only to what are called "core" plugins and "featured" plugins. They are really just a convenience for selecting plugins. The "core" plugins also include some simulation inside the Emulate, Test and Debug tabs (as well as in App Preview). Other than that, they are standard Cordova plugins that are also "plugin added" by the build server if they have been checked. Take a look at the various intelxdk.config.*.xml files that are automatically generated when you perform a build to see how the checkmarks (and third-party plugins) are communicated to the build server.

Eclipse import Phonegap project

I have the HTML/JS/config.xml files of an app that was built using online phonegap build. How can I import these files into a project that I can work on with Eclipse/Phonegap CLI ?
The documentation here is all you need, just follow the steps.
http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface
First you will need to create a new project using your existing HTML/JS/CSS/icons
put your files in a folder, let's say c:\oldproject
create a new cordova project using the CLI and tell it to import your existing files (replace foldername, com.test.app and TestApp with proper values)
cordova create foldername com.test.app TestApp --copy-from=c:\oldproject
Replace phonegap.js reference with cordova.js
In index.html, replace the inclusion of phonegap.js with cordova.js (note that you may choose to use phonegap CLI instead of cordova CLI to create/build the project, in that case, you could continue to use phonegap.js)
Then put back the config and add plugins
replace the generated config.xml in the project with the one of your old project
If your config.xml contains plugins (lines begining with <gap:plugin) you will have to use the CLI to add each plugin.
For example if you have the line
<gap:plugin name="org.apache.cordova.file"
you would have to call
cordova plugin add org.apache.cordova.file
Then you have to add the android platform and build the project.
cordova platform add android
cordova build android
Now your project is ready to be imported in eclipse.
Please note that I don't really see any interest in using eclipse now that you can build projects using CLI. (I personnaly use a text editor that handles javascrit much better than eclipse and then do everything with the CLI).
Final warning
If you edit code in eclipse, you will be editing files in platforms/android/assets/www/, not in /www folder.
If you use the cli commands cordova build android or cordova prepare android, the CLI will take the content of the root www folder and put it in platforms/android/assets/www, so all your changes will be lost.
So if you choose to use eclipse to edit javascript/CSS, you will have to choose either save your changes to the root www folder before you use the CLI or stop using the CLI (so if you want to add a plugin you'd have to use plugman).