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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:47:48+00:00 2026-06-04T16:47:48+00:00

I have a Library project set up and a project which depends on this

  • 0

I have a Library project set up and a project which depends on this library project – Everything compiles fine and I’ve had the Dependent project running fine however;

I’m have an intermittent problem however while using an Activity from the Library project.

My Library project can be “unchecked” as a library project and the “picker” Activity can be run in isolation. Running the Library project in it’s own right works fine with no problems.

When I use the Library project (and the “picker” Activity) from the dependent project it gives me either NullPointerExceptions (or historically DexOp) errors saying that the “picker” Activity can’t find it’s resources.

Can anybody tell me if they have experienced this before?

EDIT

Manually copying the layout.xml used by the Library project activity to the dependent project makes the project open the “picker” Activity correctly. Is this required?! Surely not? This further makes me wonder if there is a problem with merging/referencing the integer id’s from R.java in the Library project.

EDIT

I’m not sure if this is of any consequence, but one of my Library projects is a wrapper around a set of custom views used in different front end projects.

These custom views each have an Activity so that they can be tested in isolation.

One of these view’s has custom attributes, which while running in isolation work very well. However, it doesn’t seem like the dependent project correctly pull’s in the attributes and keep’s them in their original namespace, causing the imported layout’s to throw compilation errors:

[2012-05-16 12:07:28 - Project] D:\opt\workspace\CustomGlowList\res\layout\main.xml:14: error: No resource identifier found for attribute 'listId' in package 'com.company.library.glowlist'
[2012-05-16 12:07:28 - Project] D:\opt\workspace\CustomGlowList\res\layout\main.xml:14: error: No resource identifier found for attribute 'type' in package 'com.company.library.glowlist

EDIT

DexOp errors were solved by removing a duplicate file name which was present in the Dependent project. Not sure if the file name was the problem or the contents of the file.

EDIT

I’ve been unable to find a solution to this problem as of yet (although @yorkw’s answer certainly helps with the xml attributes! Thanks).

I have managed to make this problem intermittent however:

I have gone through each of the library projects and ensured they all had their own namespace (ie, com.company.library.component1, com.company.library.component2 etc). After a couple of clean’s (each project ordered with the correct precedence) this problem resolves itself, however does eventually come back when switching around library/not a library to test components.

  • 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-04T16:47:49+00:00Added an answer on June 4, 2026 at 4:47 pm

    The problem was being caused by the R files from each of the Library projects not correctly being built and referenced. The resource files are built and referenced directly from the calling project.

    Each of the Libraries need to have unique package as defined in the AndroidManifest.xml. This leads to each of it’s resources being compiled in that unique namespace within the calling project alongside the Library jar which contains the class files.

    The <code>R</code> files located in situation

    The problem becomes intermittent when switching between a library and a runnable project because a clean and build needs to take place to regenerate these files as it isn’t done automagically when unclicking the Use as library checkbox, where as the jar (and java classes) don’t require as much coaxing for them to be correctly referenced as the library projects references them when acting as a Library.

    This can lead to intermittent and also varying errors including missing references, DexOp and NullPointerExceptions depending on to what degree the R.java files have been mangled or partially built and what conflicts are taking places between packages.

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

Sidebar

Related Questions

Nothing too exotic. I have classes in a library project, which is set to
I have an Xcode project with several static library dependancies set up in the
I have a maven project that has a set of library dependancies that are
I have a library project which includes a object (.o) file. I have the
I have a class library project which contains some content files configured with the
I have a Silverlght library project that produces a dll output. This project utilises
I have WPF userControl Library project. In it I have window which has next
I have a library which supports a #define to control how it's built. However
I have multipile projects, each of which references the same library project. I want
my set up is this. I have project A , and a test project

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.