Wednesday, April 9, 2014

Made a map of the demo, reported Caused by: java.lang.ClassNotFoundException, you help me find where the wrong


This is the error log
 
05-01 05:00:33.720: E / AndroidRuntime (852): FATAL EXCEPTION: main
05-01 05:00:33.720: E / AndroidRuntime (852): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo {com.chenjb.mapstest / com.chenjb.mapstest.DemoActivity}: java.lang.ClassNotFoundException: com . chenjb.mapstest.DemoActivity in loader dalvik.system.PathClassLoader [/ data/app/com.chenjb.mapstest-1.apk]
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2585)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread.handleLaunchActivity (ActivityThread.java: 2679)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread.access $ 2300 (ActivityThread.java: 125)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java: 2033)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.os.Handler.dispatchMessage (Handler.java: 99)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.os.Looper.loop (Looper.java: 123)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread.main (ActivityThread.java: 4627)
05-01 05:00:33.720: E / AndroidRuntime (852): at java.lang.reflect.Method.invokeNative (Native Method)
05-01 05:00:33.720: E / AndroidRuntime (852): at java.lang.reflect.Method.invoke (Method.java: 521)
05-01 05:00:33.720: E / AndroidRuntime (852): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java: 868)
05-01 05:00:33.720: E / AndroidRuntime (852): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java: 626)
05-01 05:00:33.720: E / AndroidRuntime (852): at dalvik.system.NativeStart.main (Native Method)
05-01 05:00:33.720: E / AndroidRuntime (852): Caused by: java.lang.ClassNotFoundException: com.chenjb.mapstest.DemoActivity in loader dalvik.system.PathClassLoader [/ data / app / com.chenjb.mapstest -1.apk]
05-01 05:00:33.720: E / AndroidRuntime (852): at dalvik.system.PathClassLoader.findClass (PathClassLoader.java: 243)
05-01 05:00:33.720: E / AndroidRuntime (852): at java.lang.ClassLoader.loadClass (ClassLoader.java: 573)
05-01 05:00:33.720: E / AndroidRuntime (852): at java.lang.ClassLoader.loadClass (ClassLoader.java: 532)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.Instrumentation.newActivity (Instrumentation.java: 1021)
05-01 05:00:33.720: E / AndroidRuntime (852): at android.app.ActivityThread.performLaunchActivity (ActivityThread.java: 2577)



 
package = "com.chenjb.mapstest"
android: versionCode = "1"
android: versionName = "1.0">



android: icon = "@ drawable / ic_launcher"
android: label = "@ string / app_name">
android: name = ". DemoActivity"
android: label = "@ string / app_name">



















 

Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: orientation = "vertical">

Android: id = "@ + id / mapview"
Android: layout_width = "fill_parent"
Android: layout_height = "fill_parent"
Android: apiKey = "0Ao5sdg8IRBg707AascNLDMcvcvcvcvc7PDVyOtnA"
Android: clickable = "true"
Android: enabled = "true" />





 
public class DemoActivity extends MapActivity {
private MapView myMapView;

@ Override
public void onCreate (Bundle savedInstanceState) {
super.onCreate (savedInstanceState);
setContentView (R.layout.main);

myMapView = (MapView) findViewById (R.id.mapview);
myMapView.setBuiltInZoomControls (true);
System.out.println ("onCreate ....");
}

@ Override
protected boolean isRouteDisplayed () {
return false;
}
}
<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
You can see from the manifest, I already registered. DemoActivity
But still error classnotfoundexception. . . Tangle. . .
Reply:
Halo.
. DemoActivity
Manifest in. Front nothing you know what does it mean?
Represents the package name, that is, DemoActivity this class is in a package with the same name and package name.

Now he tips you find little, and then you check it works where enrollment package name and class files are the same.
Inconsistent into consistent enough, or you simply put the path to write a whole.

If consistent, then clean it, on it.
Reply:
The same problem can not be solved! ! ! ! Solving the answer upstairs tried, to no avail
Reply:
I was the android sdk version 1.6 from 2.2 modified into place and then modify the next error. This exception does not report it.

Reply:
No one can solve this problem?
Reply:
After you import your own jar actually play in such cases, there are wood touched ah
Reply:
reference to the second floor Etzmico reply:
halo.
. DemoActivity
Manifest in. Front nothing you know what does it mean?
Represents the package name, that is, DemoActivity this class is in a package with the same name and package name.

Now he tips you find little, and then you check it works where enrollment package name and class files are the same.
Inconsistent into consistent enough, or you simply put the path to write a whole.

If consistent, then clean it, on it.
......
is a clean look, and do not try more than a few times, I finally succeeded, who suggested after the encounter also try!
Reply:
Encounter a similar problem,
Causes: the project will be converted into mvn time, mvn will remove / export of src Project.
The solution: in java Build Path \ Source Join Project / src

Reply:
Clean positive solutions
Reply:
Useless useless useless

No comments:

Post a Comment