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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:45:12+00:00 2026-06-02T10:45:12+00:00

Possible Duplicate: How do I load my own Java class in C on Android?

  • 0

Possible Duplicate:
How do I load my own Java class in C on Android?
Application works in debug / run from Eclipse, but .APK gives .classNotFoundException when parsing XML layout that contains a custom View

In Android, I am accessing a native C library, by doing:

System.loadLibrary("testlib");

To load a native library.
In the JNI_OnLoad() function, it is trying to find a Java glue code class:

JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
        JNIEnv *env;
        jclass k;
        jint r;

        r = vm->GetEnv ((void **) &env, JNI_VERSION_1_4);
        k = env->FindClass ("com/test/android/aclass");

The FindClass() fails, and throws a NoClassDefFoundError exception.
Any idea why I cannot see my Java class from my C code?

I use this same library in another test application, and it works (so I am confident that the library works). I don’t see why one app can find the java class, while the other cannot.

  • 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-02T10:45:17+00:00Added an answer on June 2, 2026 at 10:45 am

    Found the answer.
    My clue was that it would run fine if I ran it through eclipse, and only had this problem when I created a .apk file.

    I found the solution here: Application works in debug / run from Eclipse, but .APK gives .classNotFoundException when parsing XML layout that contains a custom View

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

Sidebar

Related Questions

Possible Duplicate: Application works in debug / run from Eclipse, but .APK gives .classNotFoundException
Possible Duplicate: Slow Android emulator I am using Eclipse to load the Android project
Possible Duplicate: Dynamic Resource Loading Android In Android, I can load a string from
Possible Duplicate: JQuery ajax cross domain I need to load content from another websites
Possible Duplicate: Simulate steady CPU load and spikes I need to write an application
Possible Duplicate: Import / read / load variables from matlab matfile it C# I
Possible Duplicate: Create instance of “Class” Using “Reflection” in JavaScript Java has Class.forName(XYZClass) to
Possible Duplicate: OutOfMemoryError: bitmap size exceeds VM budget :- Android In my application I
Possible Duplicate: how to load an imageview by url in android? I am having
Possible Duplicate: load content from external page into another page using ajax/query May be

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.