Reputation: 1192
I am writing a very simple Android app constituted by an activity and a service. I load my service in the activity by doing
@Override
public void onResume()
{
super.onResume();
mServiceIntent = new Intent(this, RemoteIntegerService.class);
ComponentName name = startService(mServiceIntent);
TextView mainText = (TextView)findViewById(R.id.mainText);
mainText.setText(name == null ? "(null)" : name.getClassName());
}
When I run the application on my Galaxy Tab or in a virtual device, everything looks fine, and the mainText reads the correct class name.
But when I start the app in Eclipse with adb's "debug over usb feature", I have an error in the Intent constructor (in the real device as well as in a virtual one). Here's the stack trace :
RemoteInteger [Android Application]
DalvikVM[localhost:8621]
Thread [<1> main] (Class load: RemoteIntegerService)
DexFile.defineClass(String, ClassLoader, int, ProtectionDomain) line: not available [native method]
DexFile.loadClassBinaryName(String, ClassLoader) line: 207
PathClassLoader.findClass(String) line: 211
PathClassLoader(ClassLoader).loadClass(String, boolean) line: 540
PathClassLoader(ClassLoader).loadClass(String) line: 500
RemoteIntegerActivity.onResume() line: 28
Instrumentation.callActivityOnResume(Activity) line: 1153
RemoteIntegerActivity(Activity).performResume() line: 4428
ActivityThread.performResumeActivity(IBinder, boolean) line: 2217
ActivityThread.handleResumeActivity(IBinder, boolean, boolean) line: 2255
ActivityThread.handleLaunchActivity(ActivityThread$ActivityClientRecord, Intent) line: 1769
ActivityThread.access$1500(ActivityThread, ActivityThread$ActivityClientRecord, Intent) line: 122
ActivityThread$H.handleMessage(Message) line: 1002
ActivityThread$H(Handler).dispatchMessage(Message) line: 99
Looper.loop() line: 132
ActivityThread.main(String[]) line: 4025
Method.invokeNative(Object, Object[], Class, Class[], Class, int, boolean) line: not available [native method]
Method.invoke(Object, Object...) line: 491
ZygoteInit$MethodAndArgsCaller.run() line: 841
ZygoteInit.main(String[]) line: 599
NativeStart.main(String[]) line: not available [native method]
Thread [<8> Binder Thread #2] (Running)
Thread [<7> Binder Thread #1] (Running)
Edit
Copied the full stack trace
MyService -> RemoteIntegerService (real name, to be coherent with stack trace)
Edit 2 - Sub-question
I can't find any information about the error. The program just stops, I see the stack trace, but nothing else. On Visual Studio I have a popup describing the Exception that occured. Is there anything like that in Eclipse ?
Upvotes: 2
Views: 864
Reputation: 13539
As Julien pointed out the debugger may stop with the message:
defineClass(String, ClassLoader, int, ProtectionDomain) line: not available [native method]
because a breakpoint has been set on a class. Removing the breakpoint solve this problem.
Upvotes: 1