Mark M. | has entered the room |
Mark M. | turned on guest access |
May 9 | 4:20 PM |
matthew w. | has entered the room |
Mark M. |
hello, Matthew!
|
Mark M. |
how can I help you today?
|
matthew w. |
Hi Mark, pleased to meet you
|
matthew w. |
yes i've a problem where i'm creating an Android project that has a project library in it. i have declared the library as 'is library' and in the main app i have added it as a library
|
matthew w. |
the problem is the library apk cannot be found
|
matthew w. |
when i run the app
|
Mark M. |
there is no library APK
|
Mark M. |
an Android library project does not generate an APK
|
Mark M. |
your main application project generates an APK
|
May 9 | 4:25 PM |
matthew w. |
Another problem i have noticed is a classCastexception on the application object
|
matthew w. |
in the library i have extended the Application object, i want to use this appObj in the main Application, but i get this exception
|
Mark M. |
does your manifest in the main application indicate that it should use this library's class?
|
May 9 | 4:30 PM |
matthew w. |
:)no... i've declared activities and services from the library in the main Application's Manifest... but no there is no <uses> library
|
Mark M. |
that is not what I mean
|
Mark M. |
there is not supposed to be a <uses-library>
|
Mark M. |
however, a custom Application subclass is not going to be used magically
|
Mark M. |
your <application> element needs the android:name attribute
|
Mark M. |
where the value is the fully-qualified class name of your custom Application subclass
|
May 9 | 4:35 PM |
matthew w. |
So if my library Application class has been extened and given the name ApplicationObj, i need to specify this name in the the main applications <Aplication> Tag?
|
Mark M. |
yes
|
matthew w. |
ok i'll give it a whirl? How long are you are for... i'm uk time
|
matthew w. |
around for, i meant
|
Mark M. |
the chat is scheduled to run for another 22 minutes
|
matthew w. |
ok cheers
|
May 9 | 4:45 PM |
Susheel C. | has entered the room |
matthew w. |
no there is still a problem. In the console window eclipse is saying couldn't find library apk
|
Mark M. |
hello, Susheel!
|
Susheel C. |
Hi Mark, whenever you are ready I have only one question for you
|
Mark M. |
Matthew: perhaps you are trying to run your library
|
Mark M. |
Susheel: go ahead
|
Susheel C. |
I have a custom view. I drew a rectangle on canvas. Is it possible to make the view listen to touch events?
|
Susheel C. |
if so how?
|
Mark M. |
override onTouchEvent() and do whatever you need to
|
matthew w. |
i can post you the logcat statements. sorry but i've just joined your site, can i post them here or would you prefer a SO question and i'll bump from your site?
|
Susheel C. |
Ok. Great. Thanks Mark! Have a good day :)
|
Susheel C. | has left the room |
matthew w. |
i'm running the main application (MainActivity)is in there.
|
Mark M. |
Matthew: then there is a problem with your Eclipse configuration
|
Mark M. |
again, there is no library APK to be run
|
May 9 | 4:50 PM |
Mark M. | |
Mark M. |
or perhaps https://stackoverflow.com/a/13448679/115145
|
May 9 | 4:55 PM |
matthew w. |
ok removed the library as a project dependency. the apk problem has gone, but there is a ClassNotFound exception regarding the Application Object
|
matthew w. |
class not on path it says
|
Mark M. |
that's because you removed the library project
|
Mark M. |
go to Project > Properties, click on the Android item in the list
|
Mark M. |
then click the Add button next to the Libraries list, find your library, click OK
|
Mark M. |
it will now appear in the list
|
Mark M. |
click OK to close the properties dialog
|
Mark M. |
do all that for the main project
|
Mark M. |
the main project itself should not be a library ("Is Library" unchecked)
|
Mark M. |
at this point, run the main project
|
Mark M. |
you can read more about how to define and connect library projects at https://developer.android.com/tools/projects/pr... and in the book
|
May 9 | 5:00 PM |
Mark M. |
if you wind up back at the same error as before, then there may be an issue with the run configurations of your main project
|
Mark M. |
and that's a wrap for today's office hours chat
|
Mark M. |
the transcript will be archived at http://commonsware.com/office-hours/ shortly
|
matthew w. |
ok thanks Mark
|
Mark M. |
the next chat is Tuesday, 10am US Eastern Time
|
Mark M. |
have a pleasant evening!
|
matthew w. |
cheers, you too
|
matthew w. | has left the room |
Mark M. | turned off guest access |