开发者

Debug error InvocationTargetException?

开发者 https://www.devze.com 2023-03-26 05:50 出处:网络
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):at dalvik.system.NativeStart.main(Native Method) 08-05 00:25:13.320: ERROR/AndroidRuntime(16232): Caused by: java.lang.reflect.InvocationTargetException
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):     at dalvik.system.NativeStart.main(Native Method)
08-05 00:25:13.320: ERROR/AndroidRuntime(16232): Caused by: java.lang.reflect.InvocationTargetException
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):     at java.lang.reflect.Method.invokeNative(Native Method)
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):     at 开发者_高级运维java.lang.reflect.Method.invoke(Method.java:491)
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):     at android.view.View$1.onClick(View.java:2678)
08-05 00:25:13.320: ERROR/AndroidRuntime(16232):     ... 11 more

i keep getting these errors while running this method.

public void watchVideo(View view) {
    video.setVideoPath(current.url);
    video.setMediaController(new MediaController(this));
    video.requestFocus();
    video.start();
}

Current is the YouTubeResult object from the Gdata api.

static YouTubeResult current;


Just googling around, I have found this:

Normally "java.lang.reflect.InvocationTargetException" occurs when java compiler finds 2 different classes with same name in 2 different packages. when u r importing both classes at a time and when you r trying to create object of that class it throws "java.lang.reflect.InvocationTargetException" exception .

The solution is that when you are creating the object of the class use package name also along with class name so that compiler knows what class it has to use.

Also, try doing Project>Clean in Eclipse IDE. I hope I could be of some help. Cheers.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号