Mobile/Fennec/Android/IDEs: Difference between revisions

No edit summary
Line 1: Line 1:
There is support for building Fennec using Eclipse or IntelliJ in the tree.
There is support for building Fennec using Eclipse or IntelliJ in the tree.


= IntelliJ with Gradle =
= IntelliJ or Android Studio with Gradle =
This is currently the preferred direction that IDE support will be moving towards.
This is the direction that IDE support is moving towards.


nalexander has a [http://www.ncalexander.net/blog/2014/10/23/building-fennec-with-gradle-and-intellij-first-steps/ blog post] for getting a basic setup with IntelliJ.
* First, build and package your tree:


A few additional steps that are not included in the blog entry
./mach build && ./mach package
* Add the Android SDK for building
 
** (File >) Project Structure (this is *not* in general settings)
* Second, configure Gradle to build Fennec.  '''Do not skip this step: it configures your object directory for Gradle.'''
* Add *.java.in (and other preprocessed) files to (settings) > File Types > Java source files (in order to handle files like AppConstants.java.in)
 
* Increase memory in <intellij-topdir>/bin/idea.vmoptions
./mach gradle-install
** Some suggested values for min and max:
 
*** Xms512m
* Optionally, verify that Gradle can build Fennec:
*** Xmx2048m
 
** Optionally, toggle "Show Memory Indicator" to On
./mach gradle build
 
* Finally, import the newly created Gradle projects into IntelliJ/Android Studio:
** ''File'' > ''Import Project...'' and select <tt>$OBJDIR/mobile/android/gradle</tt>, where <tt>$OBJDIR</tt> is your object directory.  (The correct directory is printed by the |mach gradle-install| command.)
** Select ''Import project from external model'' > ''Gradle'' > ''Next''.
** Select ''Use customizable gradle wrapper'' > ''Finish''.
 
You should have a shiny new Gradle-based project in your IDE!  You'll need to configure your Android SDK:
 
* ''File'' > ''Project Structure''
** Select ''Android API 21 platform'' for the Project SDK (or whatever is appropriate for your configuration); and
** Select ''7 - Diamonds, ARM, multi-catch etc.'' for the Project language level.
 
You should be all set!  Try it out by choosing ''Build'' > ''Rebuild project''.
 
== Trouble shooting ==
 
=== Memory ===
 
IntelliJ/Android Studio can require a good deal of memory:
 
* Optionally, toggle ''Show Memory Indicator'';
* you might need to increase memory in <tt>$INTELLIJ/bin/idea.vmoptions</tt>.  Suggested values for min and max are:
** Xms512m
** Xmx2048m
 
=== Additional file types ===
 
You might want to add <tt>*.java.in</tt> and other preprocessed files to ''Settings'' > ''File Types'' > ''Java source files''.  This will help you browse the few preprocessed files remaining, including <tt>AppConstants.java.in</tt>.
 
== Video tutorial ==
 
nalexander has a slightly [http://www.ncalexander.net/blog/2014/10/23/building-fennec-with-gradle-and-intellij-first-steps/ outdated blog post] that describes an earlier version of this basic setup with IntelliJ.  It includes a short video tutorial.


= Eclipse =
= Eclipse =
Confirmed users
355

edits