Showing posts with label Android Studio. Show all posts
Showing posts with label Android Studio. Show all posts

Tuesday, March 11, 2014

Let's have some IDE fun

During any given day I might be in 6 different IDEs. Eclipse, IntelliJ, Android Studio, Xcode, AppCode, and Aptana. Generally I have an instance of Sublime text editor running too. I use them for the following things:

Eclipse - Java server side work (our REST services)
IntelliJ - Java one off utility work
Android Studio - Java Android mobile development
Xcode and AppCode - Objective C iOS mobile development (some Mac work too)
Aptana - JavaScript with AngularJS, bootstrap and other libs
Sublime - taking notes, small file edits including .gitignore and other system type files

At times it can drive you crazy. I use a Mac at work due to my iOS needs and depending on the IDE I might use CMD+S to save or Ctrl+S. Since I have a PC background and I switch to Ctrl+S at home in any IDE I am in when there. I screw up the keystrokes at times but generally have a feel for which IDE I am in at any given moment.

Eclipse is the old standby I have use for years. There are a ton of plugins for it to do nearly anything but you can't always get them to work as expected or even together. We just switched from SVN to GIT at work. Probably need to throw out the SVN plugins as I will not be using them and no real need for them to load up each time. Also the menu system gets a bit cluttered. Heck it might be a good time to start with a fresh Eclipse install as I also have the Android plug-ins running and I have switched to Android Studio for that work. Code completion works ok but is not spectacular. Refactoring works and has not crashed on me. The editor is fast and has a ton of features.

IntelliJ has a great Dracula dark theme built right in. I run a dark theme in Eclipse too but it does not theme everything perfectly. I handle one off programming in IntelliJ. Testing code bits, working on small stand alone utilities. I could do some of that in Eclipse too but I tend to have the server stuff open there and switching workspaces in Eclipse is slow as it is a full reload of the IDE. I could use workspaces in Eclipse and I do at times but our server stuff is rather large so I prefer to leave it sit by itself.

Android Studio is an IDE I like a lot as it is IntelliJ based. There have been some growing pains with the constant updating to the newest version of gradle but in general the IDE is superior to Eclipse. It has better code completion, a better preview window for your XML based layouts, shows the colors and icons in the gutter, makes it easier to convert string into the string table, shows the replacement string in code instead of the string ID and a bunch of other smaller bits of "thanks for doing that" areas. I would say that Eclipse is faster at building and getting the code on a device but I am willing to forgo that speed for all the other features Android Studio offers. It works well with Genymotion, the device emulator I use.

Xcode is my least favorite IDE of the bunch. I have to use it for iOS development but it is behind the times in areas like refactoring and its code completion tends to not be as helpful as other IDEs. Sure, you get a full list of what is possible but it does not move the most commonly used ones to the top of the list. It also crashes on me more than any of the other IDEs especially when it comes to refactoring. I have had it crash when refactoring a variable that only appears twice in a 20 line method. It makes you scared to use it. It was also terrible when it comes to using SVN. GIT is much better. I wish it would offer to automatically include needed H files instead of my manually moving to the top of the file to type them in.

AppCode is also from IntelliJ. I use it when I am doing heavy Objective C coding when I already have the UI in place. So far its refactoring has worked every time crash free. It has more intelligent code suggestions, if you add a reference to an object it will prompt to add the proper H file, it handles CocoaPods nicely. There are so so many areas where it is coder friendly. Sadly it does not have an Interface Builder replacement so you end up back over in Xcode to handle those chores. They sync together without a hitch and both use the same project files making moving between them relatively painless.

Aptana has some nice code completion aspects for CSS and HTML along with a solid JSHint tie in. Since our server build does not allow JSHint errors to pass it makes it so much easier to catch them before you push to master. It is Eclipse based but focused on JavaScript which means I could end up cluttering it with plugins but so far I have kept it down to the minimum I need for JS programming. I have used this IDE flavor for the least amount of time of those listed but with my heavier involvement in JavaScript I have been very happy with it.

Sublime is my go to editor. I leave multiple tabs open with "To Do" lists for each of the projects I have going at any time. This allows me to type in quick notes so I don't forget something because people tend to drift in and out of my office with suggestions the mobile app, to share some tidbit of useful information about the server, a GIT command or something else helpful. I have a file for general work info, one for Android and one for iOS info open all the time and then I open and close other files as needed. The color coding support in Sublime for a multitude of file formats is awesome. I also use it to pretty print XML and JSON when I copy / paste server responses out of the Chrome web tools window. 

It can fry your mind to shift in and out of so many programming languages and IDEs in any given day. Of course I try to keep it to a minimum but that is not always in my control. My preference would be to stick in the world of mobile doing Android and iOS development. Right now that is on hold so I am helping out on the JavaScript team. Lots of time on Stack Overflow and doing web searches as my brain does not have a solid cache of JavaScript programming idioms and patterns. Looks like Aptana it is for the next few months.

Wednesday, October 23, 2013

Mavericks, Java, Android Studio, GIT

I installed Mavericks today on my MacBook Pro. The install went fine but it stop me cold for developing on my Android project. Sweet Apple revenge? Not really, they just don't install the developer tools you need by default. I wish the update would look at what you had and update to match but it does not. I did an update of the OS, not a clean install.

Some are getting prompted to install the Apple version of Java 6. I did not get prompted to do so the first time I tried to start up Android Studio. It just did nothing, no bouncing icon and no error message. Highly annoying and not user friendly.

Apple link to Java 6 that works on Mavericks http://support.apple.com/kb/DL1572

With that installed I was able to fire up Android Studio but it could not find GIT. I shut it down.

I was waiting on the install of Xcode to finish. Once that was done I fired up Xcode and it decided to grab the developer command line tools. Now GIT is installed and ready to go.

I appear to be back up and running as far as my Android and iOS development goes.

Outlook is acting weird. It decided to sort of dock itself and moving it just popped back into place when I tried to move it. I then tried Window -> Minimize and restore but that did not help so I did Window -> Zoom and then Outlook did some odd animation witch under a house shrinking up into the corner. I did command Q to quit and restart. It came up with half an email message scrolled off the screen. Doing View -> Navigation Pane seemed to get it back in order for now. It is painting weird in that you can only see half the "Today"header of the email headers.

Macports is not working. First it could not find GNUTAR so I did the following:

sudo ln -s /usr/bin/tar /usr/bin/gnutar

Which let it update and start the update of apps but now it has new issues. They plan and releasing an update soon so I am going to wait on that.

What I really want fixed is the crappy multiple monitor support of Mountain Lion. I really hope Mavericks makes that better. So far it has been a real time killer to get things up and running as a developer though.

I really miss Xtrafinder too. I know Apple added tabs but the other huge feature to me is the ability to sort directories to the top of the listing always. I understand if you don't like that but give us a freaking setting Apple! I don't want to scroll all over to find a stupid directory intermixed with my files. I am sure there are plans to update that too.

Tuesday, August 27, 2013

Finally have new ActionBarActivity working with Android Studio

Yes I am a sucker for punishment. The new Android Studio 0.2.6 came out today and I found this out my usual way - saw it on Reddit. Since I just battled this beast yesterday I thought I would give it yet another shot.

Post install it still could not build my project but was mad about even more things. I decided to delete the entire project off disk and start fresh especially since it kept being mad about gradle build settings and make settings that I would change and save and it would forget I had done that.

I deleted the project. Started AS, told it to create a new project with old project name, single activity. While it did this it appeared to download some additional gradle files. Probably updating from 1.6 to 1.7 but I am not sure. It did not do that when opening my old project.

Shut down AS. Copied the java source code, resource files and manifest over from the working Eclipse project. I did not want to risk changes to a working project. Started up AS and it found all the files automatically. I love that about Java, just put the files in the proper directly and have at them.

Copy in the build.gradle from this web site http://www.recursiverobot.com/post/59267986367/setting-up-the-new-actionbarcompat-in-android-studio then add the dependencies to the two bonus libraries I am using - achartengine and GSON. Run the rebuild all and everything worked like a champ. No errors. I was able to deploy it to my Note II and it ran perfectly.

Obviously multiple things happened here. AS was upgraded and it needed to upgrade various support tools which it did not do until I forced it via creation of a new project. That is pretty annoying. Once that was in place it is finally working.

I am glad they fixed the issue dealing with Google support libraries. The actual editing you do to the build.gradle is simpler than the project import work I had to do in Eclipse. You can read those steps here http://developer.android.com/tools/support-library/setup.html

Do I think this project will keep working? Who knows, seems on the AS side of things they make changes that require you to start with a fresh project or you are hosed. Gradle is in flux too. I like the editor and layout preview features of AS so I may use it for the next parts of this project. I really want to come up with functional tablet layouts beyond what you can do on the phone. I have everything split into fragments so this should be possible. I also want to use more than just the pie chart from achartengine and have more than one chart on screen in tablet mode.

This ties back into the JavaScript work I was doing in another area of our product. While that works in the browser on tablets it is slow and cumbersome. I should be able to do something similar in native code with large gains in speed and usability.

Using Genymotion to test against various device sizes. Nice and fast and recommended when you are not testing on an actual device. Very happy they added device rotation support.

Tuesday, June 18, 2013

Why I stopped using Android Studio - for now

I was pretty happy using Android Studio. Loved the way I could see the preview of a layout while working on the layout. I had written a new app from scratch to match the functionality of our current iPhone app using Android Studio. I also like the dark theme they provide. Easy on the eyes.

Then I ran into a problem that made me stop using it. I wanted the app to run on more devices so I turned towards ActionBarSherlock. I found various posts on Stack Overflow on how to make it work. I tried them all but was ending up with some weird gradle errors that I was unable to solve.

Gradle: A problem occurred configuring root project '{my project}'.
> Failed to notify project evaluation listener.
   > Main Manifest missing from /Users/kpeck/AndroidStudioProjects/{my project}/AndroidManifest.xml

I have a manifest file of course. It is not in the directory given. I even tried to copy my the file to that directory, even though it does not belong there, and attempted the build again but it still did not work.

It is possible that starting a project from scratch with ABS in it and then copying in my files may work. I will have to give that a shot at some point.

Having run ActionbarSherlock under Eclipse in the past I knew pretty much what to do and had it up and running in a matter of minutes. Import the project into the workspace, delete the duplicate android-support-v4.lib, set the dependency between ABS and my project and it was working. I spent the rest of the day converting code to ABS format. That was generally pretty easy with a few minor snags around loaders.

At some point I may go back and attempt to get it working in Android Studio but right now I need to move forward on the project. I have other areas that I want to convert to activities hosting fragments. Currently I only converted the one that needed a loader but I have some ideas on how to layout items on a tablet that would benefit from fragments.

Android Studio keeps changing the way you deal with project settings. It was through a dialog but now they want you to manually edit things in the build files. Somethings happen automatically as you import but it does not seem to finish the job. It is still alpha software and they are pushing out changes quite often. I want to get familiar with gradle but I don't have the time to pause right now and do that.

I also found the preview has some issues especially with Relative Layouts. The above / below / left / right layout parameters seem to be suggestions in the preview. They work fine in the emulator or on a device but that gets frustrating. I may see the screen look just right in the preview then a change to the XML in an area unassociated to the Relative Layout will cause it to paint incorrectly, usually overlapping controls. Really need a preview I can trust so I am not chasing down issues that don't exist.

Probably good to wait another release or two of Android Studio. There will be more tutorials on how to make things like ABS work with it and I can skip the headaches. Back to trusty old Eclipse for now. I found a dark theme that is reasonable for it but it only changes the editor pane. That is the largest part of the screen so it is better than nothing.

Wednesday, May 29, 2013

Back as solo mobile developer - not easy

Being the solo mobile developer at a job is not easy. I had just gotten used to having a couple of developers around me at my previous contract position. Everyone had bits and pieces of experience in different areas so you would quickly get answers to questions without doing a Google search. They might have some sample code laying about from another project or just know how to do it.

Sure the big boss here wrote the initial iOS code that I have been cleaning up and adding features against but I rarely get to speak with him and he has no Android background. I have been working on the Android port this week getting stuck on silly things that the guy I worked with at the last place would have handled with ease as he had a lot of background in those areas. Now that the core networking is in place I can start moving forward at a pretty good clip.

A real feeling of isolation when you have developers all around you but they either don't know the language (Objective C) or the framework (Android SDK) thus you can't really bounce any ideas off of them. Sure I can hit them up for general business knowledge or Java questions but not for the meat of the development cycle.

For my Android work I have been using Android Studio. I know it is a 0.1 release but that is really just the Android plug-in side of things. The over all IDE is at version 12 and I have enjoyed using IntelliJ in the past. I like the dracula theme as far as colors go.

The ability to edit layout XML and see the results side by side in the preview window is super handy. I have gotten that to generate crash reports from time to time but they did not kill the IDE or lose any of my work.

What I miss from Eclipse is the new class wizard. It asks for the base class and interfaces and lets you quickly build things out. I have asked about this on the IntelliJ forms and they basically stated you can do all of that via a number of steps. I want a Wizard. I also want the auto add of the Activity to the manifest. I should not have to do all that work manually every time I add a new activity to the project. Since this is a new project that has been happening a lot.

The Log Cat filter seems pretty iffy too. I turn it on to filter out things but it forgets about that between program runs so I have to go back to "No Filters" then back to my filter again. It is silly how much junk the emulator kicks out into Log Cat. Since I am using the HAX high speed emulator I get a ton of extra stuff.

I was happy to get the upgrade to 0.11 this morning. Good to know there is active work on Android Studio and I am sure it will continue to improve. I have been using it at home on my Win7 64 bit PC and my Macbook Pro at work. Both seems to run equally well.