0
10-24 22:37:47.926: E/Trace(31760): error opening trace file: No such file or directory (2)
10-24 21:50:17.726: E/AndroidRuntime(25669): FATAL EXCEPTION: main
10-24 21:50:17.726: E/AndroidRuntime(25669): java.lang.RuntimeException: Unable to       instantiate activity     ComponentInfo{com.example.castsample/com.example.castsample.CastSampleActivity}: java.lang.ClassNotFoundException: com.example.castsample.CastSampleActivity
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1983)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2084)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread.access$600(ActivityThread.java:130)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1195)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.os.Handler.dispatchMessage(Handler.java:99)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.os.Looper.loop(Looper.java:137)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread.main(ActivityThread.java:4745)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at java.lang.reflect.Method.invokeNative(Native Method)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at java.lang.reflect.Method.invoke(Method.java:511)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at dalvik.system.NativeStart.main(Native Method)
10-24 21:50:17.726: E/AndroidRuntime(25669): Caused by: java.lang.ClassNotFoundException: com.example.castsample.CastSampleActivity
10-24 21:50:17.726: E/AndroidRuntime(25669):    at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.Instrumentation.newActivity(Instrumentation.java:1053)
10-24 21:50:17.726: E/AndroidRuntime(25669):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1974)
10-24 21:50:17.726: E/AndroidRuntime(25669):    ... 11 more    </code>

This is the error what I encountered when running google-cast sample. And I don't modify any thing in Manifest.
Any helps will be appreciated.

henry
  • 25
  • 4

3 Answers3

0

put your libraries/jar inside libs folder. if it is still named lib, rename it to libs.

hepizoj
  • 243
  • 4
  • 9
  • I had added sup-v4.sup-v7-appcompat,sup-v7-mediarouter to libs.It may be not the problem. Thank you all the same. – henry Oct 25 '13 at 02:24
0

Try the following steps in Android project:

  • Click mouse right button on the project in "Project Explorer", then select "Properties"
  • Select "Java Build Path" in the list at left.
  • Make click on "Order and Export" tab.
  • Mark the two checkboxes for "Android Private Libraries" and "Android Dependencies", respectively, then click OK button.
  • Clean project(s) and run.

If nothing works, you might want to try some solutions from this page. Here is the most voted answer: https://stackoverflow.com/a/11776806/827110

Community
  • 1
  • 1
Amulya Khare
  • 7,718
  • 2
  • 23
  • 38
  • I have updated my answer. Seems like this problem is fairly common and most people do not know how to resolve it. – Amulya Khare Oct 25 '13 at 02:41
  • I think this not the root reason of ClassNotFoundException issue.This may be the device version is different with the project version caused. – henry Oct 25 '13 at 02:58
0

Putting v7-appcompat.jar, v7-mediarouter.jar doesn't solve the problem. It will get error in run time.
You must import 2 above project as library project. Appcompat is dependency project of Mediarouter project. Then add 2 above project as dependency project of your project.

Huy Duong Tu
  • 7,798
  • 5
  • 25
  • 46
  • You import appcompat and mediarouter project in android-sdk/extra/android directory as library project. Then Select "Java Build Path" in "Properties" of your project. Add 2 above lib project as dependency project of yours. – Huy Duong Tu Oct 29 '13 at 16:05