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

  • Home
  • SEARCH
  • 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 7849197
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:26:56+00:00 2026-06-02T18:26:56+00:00

I downloaded a source code from a library for android, compiled it and I

  • 0

I downloaded a source code from a library for android, compiled it and I got a .jar file, I included into my project and I tried to use it but I always get a java.lang.NoClassDefFoundError, I noticed that in the jar file there are not R$XXX files, I read this post: Android Library Import delete R and tried the solutions but none worked for me.

I made my own simple library and I saw that either, the R files are not included in the jar, I have to add the .class files manually using winrar but I think I am missing something simple, I am using eclipse with ADT.

Thanks to everyone

  • 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-02T18:26:57+00:00Added an answer on June 2, 2026 at 6:26 pm

    If you are creating jar files then you should not include r.java,manifeast file in the jar file.

    Because the jar wont get complied during compliation and wont create any static integer during compliation time.

    In android we have Android LIbrary which is similar to android project but can be included in other projects.

    And if still you need to have jar file then just keep class files in jar include all your resource contain in application and from java files you can use the below code to refer the resources during runtime.

    That you must use getResourseIdByName(getPackageName(), “drawable”, “icon”) instead of R.drawable.icon in your code.
    Below is the code for getResourceIdByName::

    public int getResourseIdByName(String packageName, String className, String name) {
                int id = 0;
            try {
                for (int i = 0; i < Class.forName(packageName + ".R").getClasses().length; i++) {
                    if(Class.forName(packageName + ".R").getClasses()[i].getName().split("\\$")[1].equals(className)) {
                        if(Class.forName(packageName + ".R").getClasses()[i] != null)
                            id = Class.forName(packageName + ".R").getClasses()[i].getField(name).getInt(Class.forName(packageName + ".R").getClasses()[i]);
                        break;
                    }
                }
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            }
            return id;
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Recently I downloaded Live555 server source code from their site. I tried to compile
I downloaded the source code from the below link and added to my project.
I Downloaded Svn Code IPcamera which an Android application for Live Streaming Media From
I downloaded the source code from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/ . Configure went well but when i
I have downloaded SSHCore source code which uses libssh2 library. That code build successfully,
I've downloaded some source code from Apple open source repository. The projects are .pbxproj
I downloaded the STL source code from http://www.sgi.com/tech/stl/download.html , but it only has the
I just downloaded this PHP Code Snippet Library scrpt from http://www.sourceforge.net/projects/php-csl/ , when I
I have written some code that makes use of an open source library to
I downloaded the Android PDF Viewer source code and am trying to compile it

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.