我正在 YouTube VideoPlayer 中创建应用。我能够非常好地运行它。但是当我在另一个Android应用程序中集成它时,得到以下错误。我能够在棉花糖中运行它,但当我试图在棒棒糖中运行时低于异常。
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: java.lang.NoClassDefFoundError: adamas.selfiereporter.gallery.YouTubePlayerActivity
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: at adamas.selfiereporter.approvedfiles.AllApprovedFilesFragment.callOnlineMediaShowingActivity(AllApprovedFilesFragment.java:144)
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: at adamas.selfiereporter.approvedfiles.AllApprovedFilesFragment.validateOnItemClickResponse(AllApprovedFilesFragment.java:106)
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: at adamas.selfiereporter.approvedfiles.AllApprovedFilesFragment.onReceiveNotification(AllApprovedFilesFragment.java:91)
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: at adamas.selfiereporter.common.FragmentBase$1.onReceive(FragmentBase.java:29)
07-03 15:46:34.188 19813-19813/adamas.selfiereporter W/System.err: at android.app.LoadedApk$ReceiverDispatcher$Args.run(LoadedApk.java:866)
07-03 15:46:34.191 19813-19813/adamas.selfiereporter W/System.err: at android.os.Handler.handleCallback(Handler.java:739)
07-03 15:46:34.191 19813-19813/adamas.selfiereporter W/System.err: at android.os.Handler.dispatchMessage(Handler.java:95)
07-03 15:46:34.191 19813-19813/adamas.selfiereporter W/System.err: at android.os.Looper.loop(Looper.java:135)
07-03 15:46:34.191 19813-19813/adamas.selfiereporter W/System.err: at android.app.ActivityThread.main(ActivityThread.java:5254)
07-03 15:46:34.192 19813-19813/adamas.selfiereporter W/System.err: at java.lang.reflect.Method.invoke(Native Method)
07-03 15:46:34.193 19813-19813/adamas.selfiereporter W/System.err: at java.lang.reflect.Method.invoke(Method.java:372)
07-03 15:46:34.193 19813-19813/adamas.selfiereporter W/System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
07-03 15:46:34.193 19813-19813/adamas.selfiereporter W/System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)
以下是我的代码:
错误显示在: -
Intent intent = new Intent(getContext(), YouTubePlayerActivity.class);
private class MyFragment extends fragment
{
---------
--------
private void callOnlineMediaShowingActivity(String filePlayUrl) {
try {
Intent intent = new Intent(getContext(), YouTubePlayerActivity.class);
intent.putExtra(Constants.BUNDLE_MEDIA_URL, filePlayUrl);
startActivity(intent);
} catch (Throwable t) {
t.printStackTrace();
}
}
}
但如果我使用其他类代替 YouTubePlayerActivity.class
,我就不会收到错误。
请有人给我解决方案
答案 0 :(得分:0)
在运行时期间缺少相关文件时会导致此问题。请尝试以下步骤进行修复: