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 8189425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:16:28+00:00 2026-06-07T03:16:28+00:00

Here are the steps I have followed so far, with no luck. I am

  • 0

Here are the steps I have followed so far, with no luck. I am extremely new to Java projects so I suspect I may be missing something obvious.

Using Eclipse, I have created a simple Java project called TestSDK, created within that a package called com.test.testsdk, and within that the following class:

package com.test.testsdk;
public class TestClass {
    public void TestMethod() {
    }
}

This compiles without errors or warnings.

I then export this as a JAR file (TestSDK.jar) using Eclipse and the standard export options (export generated class files and resources, compress the contents of the JAR, generate manifest file). I have tried both sealing and not sealing the JAR which makes no difference.

I then create a new Android application project from File->New->Project in the Wizards list. This compiles and runs without warnings or errors on both the Android emulator and my test device (I get the hello world message).

I then add a reference to my TestSDK.jar file (using a variety of different methods as I will expand on shortly), import it into the main (and only) Android activity, and try to instantiate my TestClass and call TestMethod on it, like so:

package com.apptest.mobilesdktestapp;

import android.app.Activity;
import android.os.Bundle;

import com.test.testsdk.TestClass;

public class MobileSDKTestAppActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        TestClass test = new TestClass();
        test.TestMethod();
    }
}

This compiles fine without warnings or errors. When trying to run it on the emulator or the device, however, I get the following error in my LogCat window:

AndroidRuntime    Uncaught handler: thread main exiting due to uncaught exception
AndroidRuntime    java.lang.NoClassDefFoundError: com.test.testsdk.TestClass

Searching the web for the NoClassDefFoundError results in a lot of suggestions on how to import the JAR file such that the class path is correct. As a result, I have tried all of the following methods of importing the JAR file:

  1. “Add External JARs…” from the Libraries tab of Java Build Path in the project properties, followed by checking (or not checking, I tried both) the JAR in the Order and Export tab. Also tried moving the JAR to the top of the Order and Export list, which made no difference.

  2. Creating a “libs” folder in the project, and adding the JAR there. I confirmed that the JAR is then also added to the “Android Dependencies” thing in the project list. Also tried right-clicking the JAR file and selecting Build Path->Add to Build Path which made no difference.

  3. Moving the JAR into my Android Application project directory and doing “Add JARs…” instead of external JARs as in step 1, also all permutations of exporting or not and moving it to the top of the order list or not.

I have subsequently downloaded other 3rd party SDKs that are packaged as JAR files and included those in the very same Android application project, and those have all worked fine using any of the 3 methods above (I am able to instantiate classes from those SDKs and use them without error), which leads me to believe I am missing something or doing something wrong in my TestSDK project and/or class which is preventing it from being used in the Android Application project.

As I said, I am very new to Java, so I’m hoping it’s something simple that I’ve overlooked. Any help or guidance would be appreciated.

  • 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-07T03:16:30+00:00Added an answer on June 7, 2026 at 3:16 am

    I think I figured out what the issue was (or at least how to fix the issue, I’m still not 100% sure what I did)–

    When I created the original TestSDK java project, I let it target the default JRE in the project creation dialog (jre7).

    Checking the project properties of a new Android Application project, the Java Compiler section has “Compiler compliance level” set to 1.5. So, I tried recreating my TestSDK project again, but told it to use J2SE-1.5 as the execution environment instead of the defalut jre7.

    After doing this, exporting the JAR and importing it to the Android project’s libs directory, I am now able to instantiate the TestSDK classes and use them just fine without the NoClassDefFoundError exception.

    Best guess is that the Android application was being compiled against an older version of the JRE than my TestSDK class (which I believe was targeting JavaSE-1.7), causing the issues. Matching the two versions up has solved it.

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

Sidebar

Related Questions

I have followed the steps in here Add Google trust badge to Magento And
I followed the steps here and installed the composite_primary_keys gem. When I try to
I followed some steps I found here (can't find the URL right now, sorry)
Followed the instructions here and recreated certificates that I previously incorrectly created. Something has
Im trying to use the sdk without a canvas application, so have followed steps
How can I debug my use of gettext ? I have followed the steps
These are the incomplete steps that i have followed to call a native function
Here are the steps I've followed - pretty much this: http://www.youtube.com/watch?v=cFNtD098Bbk&feature=player_embedded Create new Tab
I'm about to build my first ipad application. I followed the steps listed here
I followed the steps here to make my existing WCF service (already working fine

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.