3

I am working on a custom Android library. I start off with a java project (in Eclipse) with another UI testing Android project.

In my UI testing project, I reference the library project in build path, and everything is good and I can test the library codes in the UI.

Later on, I decided I need to have the 'Gen' code (for custom styles attributes), so I try to change my library to an Android project (via Android-tools -> convert.. ), and disasters happens! After fixing up all the compile time problems, it finally 'let' me start the UI testing application, and bangs! When I try to create any objects from the library class, it said (in the Log) that Class not found.

Two questions:

  1. Any idea how to fix this? I tried but seems it is for referencing another .apk that need to install separately.

  2. If I just keep it to be java project (not android) for my library, can I use the resource generator? and how?

PS: the dependency (my library) is installed before the UI test application, according to the Console of Eclipse said.

Update: I tried to compile the library project to jar and reference it from the UI testing, and in this way, it works. But I don't want to use this approach since it is very slow in terms of testing.

xandy
  • 27,357
  • 8
  • 59
  • 64
  • @AlexLockwood I think this answer is what you're looking for: http://stackoverflow.com/a/11087994/818821 – Tim Kist Oct 03 '12 at 10:40

2 Answers2

1

for those who are doing same mistake like me

when library project is an android project got to

properties > android > click add button at bottom of the popup inside library section

and add project, instead of

properties > java build path > project > add

later approach is for pure java projects only .

Shailendra Singh Rajawat
  • 8,172
  • 3
  • 35
  • 40
-8

Finally I found the answer to my own question. This is actually mentioned in official documentation.

xandy
  • 27,357
  • 8
  • 59
  • 64
  • I had "-" on my projects name,i renamed the projects so now there is no "-" in the projects name,nut still R not get build,seems like classes which are not activity,service or receiver not get identified ,any help for this – Sam Sep 02 '11 at 07:47
  • 1
    @AlexLockwood did you read the link: http://developer.android.com/guide/developing/projects/projects-eclipse.html#ReferencingLibraryProject – xandy Jun 11 '12 at 00:21
  • what are you talking about? – Teoman shipahi Mar 02 '14 at 05:06
  • Yes, I read the link and am doing that. Still the same error. Also @xandy that link is dead, which is why stackoverflow recommends you post the relevant content and not the url. – edthethird Jan 29 '15 at 19:50