我已经看到了很多关于它的主题,但问题仍然存在。我的应用程序非常简单,我只有一个名为 PlayVideo 的主要活动,它启动 MediaPlayer 从 IPCAM 流式传输视频。我已经按顺序替换了 java 构建路径中的 lib 文件。我还创建了一个新的 AVD 并清理了项目。
10-22 09:28:40.411: E/AndroidRuntime(1016): FATAL EXCEPTION: main
10-22 09:28:40.411: E/AndroidRuntime(1016): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.c2s.playerfirst/com.c2s.player.PlayVideo}: java.lang.ClassNotFoundException: Didn't find class "com.c2s.player.PlayVideo" on path: DexPathList[[zip file "/data/app/com.c2s.playerfirst-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.c2s.playerfirst-1, /system/lib]]
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.os.Handler.dispatchMessage(Handler.java:99)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.os.Looper.loop(Looper.java:137)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread.main(ActivityThread.java:5103)
10-22 09:28:40.411: E/AndroidRuntime(1016): at java.lang.reflect.Method.invokeNative(Native Method)
10-22 09:28:40.411: E/AndroidRuntime(1016): at java.lang.reflect.Method.invoke(Method.java:525)
10-22 09:28:40.411: E/AndroidRuntime(1016): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-22 09:28:40.411: E/AndroidRuntime(1016): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-22 09:28:40.411: E/AndroidRuntime(1016): at dalvik.system.NativeStart.main(Native Method)
10-22 09:28:40.411: E/AndroidRuntime(1016): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.c2s.player.PlayVideo" on path: DexPathList[[zip file "/data/app/com.c2s.playerfirst-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.c2s.playerfirst-1, /system/lib]]
10-22 09:28:40.411: E/AndroidRuntime(1016): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
10-22 09:28:40.411: E/AndroidRuntime(1016): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-22 09:28:40.411: E/AndroidRuntime(1016): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
10-22 09:28:40.411: E/AndroidRuntime(1016): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
10-22 09:28:40.411: E/AndroidRuntime(1016): ... 11 more
10-22 10:05:56.052: E/AndroidRuntime(1039): FATAL EXCEPTION: main
10-22 10:05:56.052: E/AndroidRuntime(1039): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.c2s.playerfirst/com.c2s.player.PlayVideo}: java.lang.ClassNotFoundException: Didn't find class "com.c2s.player.PlayVideo" on path: DexPathList[[zip file "/data/app/com.c2s.playerfirst-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.c2s.playerfirst-1, /system/lib]]
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2137)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2261)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread.access$600(ActivityThread.java:141)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.os.Handler.dispatchMessage(Handler.java:99)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.os.Looper.loop(Looper.java:137)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread.main(ActivityThread.java:5103)
10-22 10:05:56.052: E/AndroidRuntime(1039): at java.lang.reflect.Method.invokeNative(Native Method)
10-22 10:05:56.052: E/AndroidRuntime(1039): at java.lang.reflect.Method.invoke(Method.java:525)
10-22 10:05:56.052: E/AndroidRuntime(1039): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
10-22 10:05:56.052: E/AndroidRuntime(1039): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-22 10:05:56.052: E/AndroidRuntime(1039): at dalvik.system.NativeStart.main(Native Method)
10-22 10:05:56.052: E/AndroidRuntime(1039): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.c2s.player.PlayVideo" on path: DexPathList[[zip file "/data/app/com.c2s.playerfirst-1.apk"],nativeLibraryDirectories=[/data/app-lib/com.c2s.playerfirst-1, /system/lib]]
10-22 10:05:56.052: E/AndroidRuntime(1039): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:53)
10-22 10:05:56.052: E/AndroidRuntime(1039): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-22 10:05:56.052: E/AndroidRuntime(1039): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.Instrumentation.newActivity(Instrumentation.java:1061)
10-22 10:05:56.052: E/AndroidRuntime(1039): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2128)
10-22 10:05:56.052: E/AndroidRuntime(1039): ... 11 more
显现 :
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.c2s.playerfirst"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="12"
android:targetSdkVersion="18" />
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
android:name="com.c2s.player.PlayVideo"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
我的活动课:
public class PlayVideo extends Activity{
//private String videoPath="http://192.168.0.157";
private String videoPath="http://50.73.56.89";
private static ProgressDialog progressDialog;
String videourl;
VideoView videoView;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_play_video);
progressDialog = ProgressDialog.show(PlayVideo.this, "", "Buffering Video");
progressDialog.setCancelable(true);
PlayVideo();
}
private void PlayVideo(){
try{
getWindow().setFormat(PixelFormat.TRANSLUCENT);
videoView = (VideoView)findViewById(R.id.VideoView);
MediaController mediaController = new MediaController(PlayVideo.this);
mediaController.setAnchorView(videoView);
Uri video = Uri.parse(videoPath);
System.out.println(video);
videoView.setMediaController(mediaController);
videoView.setVideoURI(video);
videoView.requestFocus();
videoView.setOnPreparedListener(new OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
System.out.println("******** BEGIN ONPREPARED ********");
progressDialog.dismiss();
videoView.start();
System.out.println("******** END ONPREPARED ********");
}
});
}catch(Exception e){
progressDialog.dismiss();
System.out.println("Video Play Error : "+e.toString());
finish();
}
}
}