Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7779785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:43:43+00:00 2026-06-01T18:43:43+00:00

I am somewhat new to Android and have been struggling for hours on how

  • 0

I am somewhat new to Android and have been struggling for hours on how to include the Hamcrest matchers in my test project. The code looks like it should run in Eclipse, no indicated errors. But when I run the test, the Hamcrest classes are not loading. I get “NoClassDefFoundError: org.hamcrest.Matchers”.

I’ve spent the last 3 hours looking through the forums figuring that someone has encountered this before, but with no luck. I must be doing something stupid as the IDE can see the classes, but the runtime doesn’t.

Here is the test source:

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import org.hamcrest.Matcher;
import android.test.InstrumentationTestCase;

public class AppDescLoaderTest extends InstrumentationTestCase {

  public void testHamcrest() {
    assertThat(3, equalTo(3));
  }
}

I’ve tried adding the hamcrest-all-1.2.jar as a Library and as an external jar. Same result both ways, code looks fine in IDE but fails to load classes at runtime.

My theory is that the hamcrest.jar is not going with the .apk file and that is why its classes are not being loaded. If that is true, how do I get it to be pushed over to the android along with the .apk file?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T18:43:45+00:00Added an answer on June 1, 2026 at 6:43 pm

    Assuming you are on the current R17 tools, then…

    I’ve tried adding the hamcrest-all-1.2.jar as a Library and as an external jar. Same result both ways, code looks fine in IDE but fails to load classes at runtime.

    Step #1: Undo all of that.

    Step #2: Create a libs/ directory in the root of your project.

    Step #3: Put your JAR in libs/.

    And you are done. This used to be the recipe just for command-line builds, but it is now the recipe for Eclipse-based builds as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am somewhat new to android development and development in general. I have a
I am somewhat new to R, and i have this piece of code which
I am somewhat new to JavaScript, and have been having an issue with a
I am somewhat new to jQuery but have been having fun trying learn about
Somewhat new to android, need some help with services. I have a service which
Hi all! I have a database table that looks somewhat like this (stripped for
I'm somewhat new to GTK and very new to Cairo. I've been tasked to
I am somewhat new to LINQ and have a quick question regarding deleting. Say,
I'm somewhat new to OpenGL. I've used it for extremely simple stuff like rendering
I'm new to Android development, and I've been playing around with it a bit.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.