Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Simple Android App (retired 2014) Shaking Things Up Adding a Shake Detector

Problem / error with Shake Detector

When I include the ShakeDetector.java class into my project it shows an error highlighting the first statement 'package com.example.crystal.ball;' and the error says 'The declared package "com.example.crystal.ball" does not match the expected package "com.example.crystalball" ΒΏDoes anybody knows what is happening? and how can I fix it?

3 Answers

John Coffin
John Coffin
10,359 Points

I had the same issue. When Ben created this class, he must have used a different package name (which was com.example.crystall.ball). All that you will need to change this one line of code to match the package name that you used when you created your project (which is com.example.crystallball).

This is fairly typical step when importing a class. It happens in one of the other projects and Ben explains it as a step (although the package name is com.teamtreehouse.ribbit ... or something like that).

Thanks man!

Thank You very much John. I did what you said. I changed the com.example.crystal.ball for com.example.crystalball (without the last dot) and it worked out!!

I had the same problem. Thanks John!