Office Hours — Today, May 9

Yesterday, May 8

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!
how can I help you today?
matthew w.
Hi Mark, pleased to meet you
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
the problem is the library apk cannot be found
when i run the app
Mark M.
there is no library APK
an Android library project does not generate an APK
your main application project generates an APK
4:25 PM
matthew w.
Another problem i have noticed is a classCastexception on the application object
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?
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
there is not supposed to be a <uses-library>
however, a custom Application subclass is not going to be used magically
your <application> element needs the android:name attribute
where the value is the fully-qualified class name of your custom Application subclass
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
around for, i meant
Mark M.
the chat is scheduled to run for another 22 minutes
matthew w.
ok cheers
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
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?
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
again, there is no library APK to be run
4:50 PM
Mark M.
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
class not on path it says
Mark M.
that's because you removed the library project
go to Project > Properties, click on the Android item in the list
then click the Add button next to the Libraries list, find your library, click OK
it will now appear in the list
click OK to close the properties dialog
do all that for the main project
the main project itself should not be a library ("Is Library" unchecked)
at this point, run the main project
you can read more about how to define and connect library projects at https://developer.android.com/tools/projects/pr... and in the book
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
and that's a wrap for today's office hours chat
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
have a pleasant evening!
matthew w.
cheers, you too
matthew w.
has left the room
Mark M.
turned off guest access

Yesterday, May 8

 

Office Hours

People in this transcript

  • Mark Murphy
  • matthew womersley
  • Susheel Chanda