Problems with Creating a Library Project

Common bugs/problems with the Android SDK the Emulator and the ADT-Plugin.

Problems with Creating a Library Project

Postby Kinglink » Thu Jul 01, 2010 5:13 am

Hello all,

First off this is my first post, so please forgive me if I violate some unspoken code here.

I recently wrote a program that is pretty simple. It's a solid program, nothing special, but it has two classes I want to use in multiple projects. They are an EULA and a Info screen. So I want to make that code into a library project.

I tried to follow
http://developer.android.com/guide/deve ... aryProject

However it doesn't discuss changing the build path at all. I've tried going through the process twice and I end up with
Code: Select all
   <activity android:name="com.hytech.utilities.EULAActivity" />
        <activity android:name="com.hytech.utilities.InfoActivity" />


in my original code manifest (as well as a com.hytech.utilities project that define both files) .

So once I've finished following their instructions. Eclipse is complaining of an error

Code: Select all
Class com.hytech.utilities.EULAActivity does not exist   .


And I'm stumped. If I add certain code to the build path it works, but it still crashes because using that way there's no jar file read in. Has anyone any experience with Library Project and ran into this?
Kinglink
Freshman
Freshman
 
Posts: 3
Joined: Thu Jul 01, 2010 5:05 am

Top

Re: Problems with Creating a Library Project

Postby blundell » Thu Jul 01, 2010 2:24 pm

Did you import the library? This is off the top of my head but:

eclipse> project > properties > java build path. Tab:Libraries > Add Jar
User avatar
blundell
Master Developer
Master Developer
 
Posts: 1610
Joined: Tue Nov 18, 2008 12:58 pm
Location: UK

Re: Problems with Creating a Library Project

Postby Kinglink » Thu Jul 01, 2010 4:37 pm

from the sounds of what they were talking in the library project developer document there, they seem to say you don't require a jar at all? Just including the project under the Android -> Library tab of the properties.

The big issue I'm running up against is, I have layouts in my library Project, but according to my understanding, you can't produce a Jar with the resources, so in that way it just won't work out for me.
Kinglink
Freshman
Freshman
 
Posts: 3
Joined: Thu Jul 01, 2010 5:05 am

Re: Problems with Creating a Library Project

Postby anarche » Sun Jul 04, 2010 1:11 pm

Has anyone else had a problem with Library Projects where there is no isLibrary option in Android Preferences??

In Project Preferences, all I get is the multiple selections of targets..
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: Problems with Creating a Library Project

Postby Kinglink » Sun Jul 04, 2010 5:51 pm

Assuming you are using Eclipse, and as long as you have the android tab, make sure you have the most recent data. You need the SDK version 6, and the ADT plugin .9.7 or higher (which was released in may and is the highest). Also make sure you're not trying to build to 2.0. I am sure that they library islibrary button is listed there. but it's not a correct build.

Do you even have the Library area to but other libraries in there?

http://developer.android.com/guide/deve ... braryReqts
Kinglink
Freshman
Freshman
 
Posts: 3
Joined: Thu Jul 01, 2010 5:05 am

Re: Problems with Creating a Library Project

Postby anarche » Sun Jul 04, 2010 10:08 pm

Yep done that.

I actually don't have v1.5r4 but I have 1.6r3. I created a new project target 1.6 and there simply wasn't a Library area in the page.

I'll check my SDK/ADT versions, I think that might be it. Thanks.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Top

Re: Problems with Creating a Library Project

Postby anarche » Tue Jul 06, 2010 12:54 pm

Yep, it was the ADT version. Thanks for that.
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: Problems with Creating a Library Project

Postby adqazwsx » Thu Jul 08, 2010 12:53 am

I am having the same problem. The project is defined as a library, the component is defined in both manifest files, the library is added to the proper project, and I have the latest version of everything.

Any ideas?
adqazwsx
Freshman
Freshman
 
Posts: 8
Joined: Thu Jul 08, 2010 12:44 am

Re: Problems with Creating a Library Project

Postby anarche » Thu Jul 08, 2010 1:01 am

Thats a different problem. Whats your problem?

I've managed to successfully get the library imported, but the build path for all of my other projects in eclipse have gone to sh*t...
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: Problems with Creating a Library Project

Postby adqazwsx » Thu Jul 08, 2010 1:37 am

Code: Select all
Class com.hytech.utilities.EULAActivity does not exist   .


This is similar to the error I am receiving.

I thought the build path did not need to be edited.
adqazwsx
Freshman
Freshman
 
Posts: 8
Joined: Thu Jul 08, 2010 12:44 am

Re: Problems with Creating a Library Project

Postby anarche » Thu Jul 08, 2010 1:52 am

No thats the funny thing - the build path of the project using the Library is fine. Its the build paths of all the Projects not using the library that are screwwed.

Probably something to do with the ADT upgrade...
anarche
Master Developer
Master Developer
 
Posts: 369
Joined: Sun Apr 11, 2010 5:21 am

Re: Problems with Creating a Library Project

Postby djpeinado » Thu Aug 19, 2010 10:35 am

Kinglink wrote:Hello all,

First off this is my first post, so please forgive me if I violate some unspoken code here.

I recently wrote a program that is pretty simple. It's a solid program, nothing special, but it has two classes I want to use in multiple projects. They are an EULA and a Info screen. So I want to make that code into a library project.

I tried to follow
http://developer.android.com/guide/deve ... aryProject

However it doesn't discuss changing the build path at all. I've tried going through the process twice and I end up with
Code: Select all
   <activity android:name="com.hytech.utilities.EULAActivity" />
        <activity android:name="com.hytech.utilities.InfoActivity" />


in my original code manifest (as well as a com.hytech.utilities project that define both files) .

So once I've finished following their instructions. Eclipse is complaining of an error

Code: Select all
Class com.hytech.utilities.EULAActivity does not exist   .


And I'm stumped. If I add certain code to the build path it works, but it still crashes because using that way there's no jar file read in. Has anyone any experience with Library Project and ran into this?


Same problem. I solved linking /src folder from library project using eclipse project java build path ('Link source...' button). As you already need library project in Eclipse I think it is a fast and scalable solution as you don't have to generate a jar everytime you change source code.

Hope it helps.
djpeinado
Freshman
Freshman
 
Posts: 2
Joined: Thu Aug 19, 2010 10:15 am

Re: Problems with Creating a Library Project

Postby djpeinado » Fri Sep 17, 2010 8:08 am

Android SDK r07 and ADT Eclipse Plugin 0.9.8 solve this issue
djpeinado
Freshman
Freshman
 
Posts: 2
Joined: Thu Aug 19, 2010 10:15 am

Top

Return to SDK/ADT/Emulator Problems

Who is online

Users browsing this forum: No registered users and 6 guests