Sunday, January 10, 2016

Error Unable to instantiate application of: About java.lang.RuntimeException




            


Android recently because to do something about the serial, we found the open source android-serialport-api, but this thing is not the android project under eclipse, so they copy its files to a project to build their own in. Named android-serialport-api, src folder is a sample packet

So modifying errors, run the project, there has been such a mistake
03-22 13: 06: 55.273: E / AndroidRuntime (825): FATAL EXCEPTION: main
03-22 13: 06: 55.273: E / AndroidRuntime (825): java.lang.RuntimeException: Unable to instantiate application android_serialport_api.sample.Application: java.lang.ClassNotFoundException: android_serialport_api.sample.Application in loader dalvik.system.PathClassLoader [/data/app/android_serialport_api.sample-2.apk]
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.LoadedApk.makeApplication (LoadedApk.java:466)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.ActivityThread.handleBindApplication (ActivityThread.java:3260)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.ActivityThread.access $ 2200 (ActivityThread.java:117)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.ActivityThread $ H.handleMessage (ActivityThread.java:969)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.os.Handler.dispatchMessage (Handler.java:99)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.os.Looper.loop (Looper.java:123)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.ActivityThread.main (ActivityThread.java:3683)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at java.lang.reflect.Method.invokeNative (Native Method)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at java.lang.reflect.Method.invoke (Method.java:507)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run (ZygoteInit.java:839)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:597)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at dalvik.system.NativeStart.main (Native Method)
03-22 13: 06: 55.273: E / AndroidRuntime (825): Caused by: java.lang.ClassNotFoundException: android_serialport_api.sample.Application in loader dalvik.system.PathClassLoader [/data/app/android_serialport_api.sample-2.apk ]
03-22 13: 06: 55.273: E / AndroidRuntime (825): at dalvik.system.PathClassLoader.findClass (PathClassLoader.java:240)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at java.lang.ClassLoader.loadClass (ClassLoader.java:551)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at java.lang.ClassLoader.loadClass (ClassLoader.java:511)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.Instrumentation.newApplication (Instrumentation.java:942)
03-22 13: 06: 55.273: E / AndroidRuntime (825): at android.app.LoadedApk.makeApplication (LoadedApk.java:461)
03-22 13: 06: 55.273: E / AndroidRuntime (825): ... 11 more


The first line says java.lang.RuntimeException: Unable to instantiate application android_serialport_api.sample.Application: java.lang.ClassNotFoundException: android_serialport_api.sample.Application in loader dalvik.system.PathClassLoader [/data/app/android_serialport_api.sample-2 .apk]

Android_serialport_api.sample.Application can not find the file, but the file is in the sample bag ah

Internet search later, it was said to be required to register in androidmanifes.xml in
But my androidmanifes.xml file is from the Internet to find the open routine in a direct copy of ah
 
& Lt;? Xml version = "1.0" encoding = "utf-8" & gt;?
& Lt; manifest xmlns: android = "http://schemas.android.com/apk/res/android"
package = "android_serialport_api.sample"
android: versionCode = "2"
android: versionName = "1.1" & gt;

& Lt; application
android: icon = "@ drawable / icon"
android: label = "@ string / app_name"
android: name = "Application" & gt;
& Lt; activity
android: label = "@ string / app_name"
android: name = "MainMenu" & gt;
& Lt; intent-filter & gt;
& Lt; action android: name = "android.intent.action.MAIN" / & gt;

& Lt; category android: name = "android.intent.category.LAUNCHER" / & gt;
& Lt; / intent-filter & gt;
& Lt; / activity & gt;
& Lt; activity android: name = "SerialPortPreferences" & gt;
& Lt; / activity & gt;
& Lt; activity android: name = "ConsoleActivity" & gt;
& Lt; / activity & gt;
& Lt; activity android: name = "LoopbackActivity" & gt;
& Lt; / activity & gt;
& Lt; activity android: name = "Sending01010101Activity" & gt; & lt; / activity & gt;
& Lt; / application & gt;

& Lt; uses-sdk android: minSdkVersion = "10" / & gt;

& Lt; / manifest & gt;


You can see, there are application of registration, so very confused, we seek to help solve, Bese! ! !
Reply:
No problem recently when packaging have encountered this problem after the package installation and operation played indicated no application errors, hit the bag again after a very strange ......
Reply:
quote 1 floor monodin reply:
a recent package also encountered this problem after the package installation and operation played indicated no application errors, re After playing the bag no problem, very strange ......


Thank you, but I am a novice package you mean what does it mean, it is to apllication, again into the sample inside it
Reply:
The Internet to find something best not directly copy into it, because this will cause some errors. You try to restart Eclipse
Reply:
ava.lang.ClassNotFoundException: android_serialport_api.sample.Application

quote the second floor akunainiannian reply:
quote 1 floor monodin reply:
In a recent package also encountered this problem, run the installation package played after application indicated no error, no problem re-fight the package after a very strange ......

Thank you, but I am a novice package you mean what does it mean, it is to apllication, again into the sample inside it


Is packaged into a release apk, I was quoted library project, and this may be related to

You find under the project in the build path is not some jar through external references, copy them out into the libs directory under the project, and add to build path, and then try again clean look
Reply:
Use svn or other items can be solved reimport
Reply:
I have encountered this problem, you can try this, I am ready to do it http://stackoverflow.com/questions/10311537/android-to-unable-to-instantiate-application-java-lang-classnotfoundexception
Reply:
Program all inherited subclass Application class are required maiinfest file & lt; application / & gt; tag registration, such as ActivityB inherited the application class, so in mainfest file & lt; application / & gt; tags in write android: name = "ActivityB." If you do not specify the above error may occur.
Reply:
Today only to see. Haha, this name wrong path bar & lt; activity android: name = "SerialPortPreferences" & gt;
& Lt; / activity & gt;

No comments:

Post a Comment