• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Android class errors

jfu

Lurker
Hello programmers, I am new here - and as you can see from the title, I am completely frustrated: I am about to write an Android application, which I haven't done before...

The problem is, that I wanted to write a JUnit-Test for some of my classes - but this stupid Anroid SDK does always lauch this absolutely lame AVD! :mad:

So I came up with the idea to move all my non-Android related classes out of the actual Android project into standard Java project. There I can easily test my classes and by adding this standard Java project to the BuildPath of the Android project, I can easily access and use my classes: no error is shown in the IDE - everything is fine.
But if I launch my full application in the AVD, it exits with following exception: NoClassDefFoundError!

What is the reason for this? :confused:
Is Android really such a big step back compared to normal Java development? :eek:

Please help!!!


EDID:
I found out, how to run a normal test from an Android project.
But why is it not possible to reference to a non-Android project?
Regarding code reuse, this is really big disadvantage!
 
FYI, if you connect an Android phone via USB you can test your applications on the phone. It's a lot faster than running an AVD.

Only difficulty is when you're trying to accommodate for multiple versions of Android.
 
Hello matttye,

I don't have and Android phone yet. But maybe I should really make this investment...

How will I get my application onto that device?
Does Eclipse offer a function for this - or do I have to move it by hand?
 
Hello matttye,

I don't have and Android phone yet. But maybe I should really make this investment...

How will I get my application onto that device?
Does Eclipse offer a function for this - or do I have to move it by hand?

Eclipse does it for you! All you need to do (when you get your android phone) is go to something like Settings - Applications - Development and then there should be a debugging option, select that and plug in your phone to your PC then on eclipse right click your package Run As - Android Application.

Doing this it should automatically detect your phone and display the app on it!
 
Eclipse does it for you!
This sounds good! - So good, that I did lend a Galaxy Tab from somebody: but it is not workiing.

All you need to do (when you get your android phone) is go to something like Settings - Applications - Development and then there should be a debugging option
Yes, I found something like that on the device (not in Eclipse).

select that and plug in your phone to your PC then on eclipse right click your package Run As - Android Application.
If I do that, it still launches the AVD... - Do I have to delete it?
Or is there a option for setting the default device?

Doing this it should automatically detect your phone and display the app on it!
Not the device, which I tried... :mad:
 
In your Run configuration in eclipse, under the "target" tab, there should be two radio buttons, labeled "manual" and "automatic." Make sure manual is checked. When you execute the run config, you should get a dialog box in eclipse that allows you to select which device (or AVD) you wish to use as your execution environment.
 
In your Run configuration in eclipse, under the "target" tab, there should be two radio buttons, labeled "manual" and "automatic." Make sure manual is checked. When you execute the run config, you should get a dialog box in eclipse that allows you to select which device (or AVD) you wish to use as your execution environment.
Thank you for this tip. - But also here I can't find the real device... :mad:
Please see the attached picture.

PS: USB debugging is activated and the device is connected to the pc!
 

Attachments

  • no_device.png
    no_device.png
    37.5 KB · Views: 98
Do you have the USB drivers installed from the Android sdk?
Thank you for this hint: no, that driver was not installed!
I installed it (together with the recent SDK updates) and restarted my whole machine -> but still no device detected by eclipse...

I tried it also with a Motorola Defy now, together with the Samsung Galaxy Tab, there are already two devices not working. :(

If I plugin the Galaxy Tab, the USB-Debugging entry gets grayed out (but the check is stell green). Also the USB connection settings are grayed out. Therefore I think, that the device is working correctly.

On the Defy this is not the case: here I am still able to change these settings. For the connection settings I have following choices:

  • Motorola Phone Protal
  • Windows Media Sync
  • USB mass storage
  • None
Which one should I choose?

Can there be something else wrong on my machine?
I already tried different USB ports.
Or should I try to reinstall the USB drivers by hand? - There was no UAC question at installing the USB driver via the SDK Manager, but my user has no admin rights.


EDIT:
I thought, that Eclipse does access the phone via a connection for mass storage devices.
But it seems, that this is not the case: I had to install a driver for the phone (not the driver listed in the Android SDK manager).
 
Back
Top Bottom