Android Studio Espresso 2.0 ClassNotFoundException

File this under “I’m writing this so when I Google for it in 6 months, it pops up”. 

 

I recently set up an existing Android project with Espresso 2.0 and immediately stared running into this error when I ran the tests: 

Running tests
Test running started
Test running failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'
Empty test suite.

I spent some time last night fighting this error and then I figured out the solution this morning.

The problem is that I’m using Dagger in this project and Espresso 2.0 also uses Dagger (see Espresso Dependencies). The core problem is that the ‘javax.inject’ dependency was borking the test run. 

How to to Fix

Change this

androidTestCompile('com.android.support.test.espresso:espresso-core:2.0')

to this: 

androidTestCompile('com.android.support.test.espresso:espresso-core:2.0') {
   exclude group: 'javax.inject'
}

 

Problem solved. 

Android From The Trenches

I recently was slated to present at Philly Emerging Tech last week. Unfortunately a few things came up and I was not able to make it at the last minute. However, I did record my talk and send it to the Philly Emerging Tech team to distribute to their attendees. They have since uploaded the talk to their Vimeo page for everyone to view. Below is that talk. The talk covers my experience in having two apps in the top 100 free category in Google Play. Enjoy.

ETE 2014 – Donn Felker – Android From The Trenches from Chariot Solutions on Vimeo.

The Best Parent I Ever Knew

This is a detour from the regular business and tech stuff I write about, but its still something I thought most people would enjoy.

This is the story of the best parent I ever knew.  

Having kids is one hell of a journey. The first few hours your newborn comes home is a moment filled with happiness, exhaustion and pure fear. Happiness due to the joy of children, the health of your child and family and the joy of creating life. The exhaustion from birth itself (if you’re the woman of course) and the emotions and the energy exerted during the last couple days is overwhelming yet energetic at the same time. Then eventually … the fear sets in. You begin to think – Ummm I’m not entirely sure I know what I’m doing. I hope I don’t mess this thing up. But then you remember you’re the one who prepared for this. Everything will be fine you tell yourself. Just hang in there, it will be Ok. Well, at least thats what I told myself.

The time has come to put your hard planning to work. You’ve had grandiose plans on how to raise your kid. You’ll do everything it takes to make them the shining example of the golden child every parent aspires to have. You’re positive other parents are going to envy your ability to sooth, redirect and manage your children with the nothing but the twitch of a finger. You know how to handle ALL of the situations that are going to arise. Hell, you read the top 10 best selling Baby, child psychology and parenting books on Amazon.com. You’re already on babycenter.com’s weekly mailing list for progress statistics. You? You’re doing all your research. You’ve got this. You’ve picked out the best organic lavender cucumber massaging tear free non-sulfate shampoo and body wash money could buy. You’ve got the best strollers, car seats and non BPA bottles you could find. You’ve got this baby thing figured out. You are going to rock this parenting gig like nobody else. You’re not sure why your other friends are having problem managing their kids. Maybe they just don’t work as hard as you? Yeah, thats probably it.  Maybe they just don’t care. There must be something wrong with them, right? Sure. Yeah … Right. You got this, right? Well, ya see, thats what I told myself.

Then life kicked in, WITH kids. Reality set in and you realize everything you thought you knew was wrong and you actually don’t know much of anything about raising kids. You end up texting those same friends you thought were inept parents in a plea for help – “OMG, he/she won’t stop crying/whining, I haven’t slept more than 4 hours in 3 days. I’m losing my mind. He/She won’t go to sleep. I need a moment to breath. Please help, what do I do?” Ha!  Welcome to the beginning of parenting. That was me and my wife with our first and we were calling our friends for help.

At that moment I realized …

I was the best parent I ever knew before I had kids. 

Android Jobs

I just launched AndroidJobs.IO, a job marketplace for Android Professionals to find great jobs from top notch companies. Some of the top notch companies publishing jobs on Android Jobs include Pandora, Square and Etsy.

If you’re and Android Professional you can learn about the new featured Android Jobs by either subscribing to the new posting notification email on AndroidJobs.IO or you can sign up for the weekly Android Dev Digest newsletter. As always, you can visit the site AndroidJobs.IO and view the postings there as well.

If you’re looking to hire and Android Professional (Engineer, Designer, Product Manager, etc) you can post a Link listing or a Featured listing. The link listing will show up at the bottom of the page, below the fold, and will be visible for 30 days. The Featured listing will be shown in a highly visible job card posted above the fold at the top of the site for 30 days. The posting will also be actively marketed to the entire Android Dev Digest mailing list that is sent out weekly (Android Jobs sponsors this newsletter). This means that your job posting will be marketed the most targeted audience you can find. Your job will be targeted to Android Professionals every week for four weeks. Your posting will also be posted on Twitter & Google+ and sent to the new job notification email list on a weekly basis.  If you run another job board and would like to have us post your new Android Jobs automatically to our board get in contact with me so we can discuss the integration details.

Enjoy!

PS: A big thank you goes out to John Sheehan from Runscope for inspiration of the site.

Android Bootstrap and Android Studio

Myself and a slew of other folks have been working on getting Android Bootstrap moved over to use Gradle so we can get it working correctly with Android Studio. Also during this process we’re moving the app over to use some of the Google libraries. Changes include:

  • Move from Maven to Gradle*
  • Using AppCompat for the ActionBar
  • Navigation Drawer implementation*
  • Using Picasso to load remote images
  • Reorganize file structure to match Gradle recommendations
  • Various library upgrades

I’m happy to say we’re at an alpha stage with this. If you go to alpha.androidbootstrap.com you can generate a project that has support for all of the items above. You should be able to open the generated project in Android Studio and start coding away.

I also spoke with Jake and a few other people over twitter recently about how it might be a good idea to change the minSdkVersion to 15 when this is released. The reason for this is because if you’re going to create a new project you’re probably going to target v15 or above anyway. Sure, you may miss out on ~30% of the available market (as of Nov 2013), but developing and supporting those old devices (pre v15) for a NEW project just doesn’t make sense most of the time. The maintenance and support costs outweigh the market position you might gain. Plus, if you did support v10+ (or whatever) you’d be losing that market and have a ton of tech debt to manage from that point forward. Why not start with v15? If that becomes the case I’ll probably remove AppCompat and use the built in Android Action Bar.

* The build.gradle is not fully complete yet, we need to implement build variants and a few other things and get the integration tests working. I’m also not happy with how the navigation drawer is implemented  It works, but it is not implemented well. It was simply a port from sliding-menu to the new library to get it work. We will be moving it to a pure fragment based implementation very shortly.