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

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.

Related

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

importing library project + different projects into Android Studio from Eclipse

Looks like the time has come for me to start using Android Studio, as I need some features that unfortunately have not been ported to Eclipse :(
Fortunately Android Studio is able to nearly-flawlessly import my projects, although I'm concerned if I'm doing it correctly
My Eclipse Workspace Layout is as follows:
LIB-CODEBASE is a big library project that contains most of the application beef
APP-KINDLE is a runnable project that uses the former, and provides some additional classes and activities for the KINDLE version of the app
APP-FIRETV is the same, but targeted to Amazon FireTV devices
APP-GOOGLE is the same, but targeted to Google-Play certified devices
APP-GCAST is the same, but targeted to modern devices supporting Chromecast.
When I import into Android Studio any of the APP-XXXX projects, it creates a copy of LIB-CODEBASE inside. So for each APP-XXXX project I have a full copy of LIB-CODEBASE inside their folders.
Is there an easy way to make all APP-XXXX projects to just share, link or include the LIB-CODEBASE project?
Inside a project you can refer an external module.
Just use:
Project
|__build.gradle
|__settings.gradle
|__app (application module)
|__build.gradle
In settings.gradle:
include ':app'
include ':codeBaseLib'
project(':codeBaseLib').projectDir=new File('pathLibrary')
In app/build.gradle:
dependencies {
compile project(':codeBaseLib')
}
Pay attention to codeBaseLib.
You have to use the path of the library inside the other project, not the root of the project.
Also for your APP-XXXX projects check if you can use a single project with different flavors.

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.

How to use eclim with gradle project

My eclim setup working perfectly with eclipse project. But I want to use gradle build system.
I am working with Libgdx framework and it provide gradle templete project.
So is there any way to use eclime + eclipse + gradle
Your best bet is to check out the Eclipse Gradle plugin, although in short you can add apply plugin: 'eclipse' to your project and then run gradle eclipse from your terminal in the root folder of your project. That should generate the necessary files for Eclipse to recognize your project, although you might need to edit the .classpath file for proper autocompletions.
That will get Eclim to recognize your project with :ProjectOpen and proper autocompletion and other goodness.
The bad is that Gradle tasks and changes to your build.gradle will require manual changes to the Eclipse side of things.
Edit: There's a new plugin available for this purpose that replaces eclim for gradle projects (but is android oriented) called Vim-Grand. It's pre-alpha and you'll want the refactor branch for now, but it's working well enough for me
You should combine it with YouCompleteMe.
What I did was use the gdx-setup.jar to create my project. I then imported it into eclipse like a normal gradle project. I closed eclipse and started up elcimd. Put "let g:EclimCompletionMethod = 'omnifunc'" in my .vimrc file. Followed the elcim instructions to use :CreateProject and that was it.
This guide was really helpful: http://www.lucianofiandesio.com/vim-configuration-for-happy-java-coding
I am able to get most or all Eclim functionality working with my libgdx project this way:
create a new libgdx project with their tools
start Eclipse
Import --> Gradle Project --> Build Model per usual libgdx project creation
shut off Eclipse, start Eclim
I get organize imports, java validation, autocompletion, all the good stuff.
That said, I want to figure out how to do this all without having to use Eclipse. I think the missing piece is the Build Models functionality. Still researching ...

Cordova (Phonegap) build undo my code changes in 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...