我有一个问题,我正在处理三天,我试图阅读不同的答案,但它没有帮助.
也有人可以帮助我!
我将AncdroID应用程序作为客户端编写为一个安静的Web服务.我可以从数据库中获取数据而没有问题,但我的问题是我使用的2个活动来处理来自数据库的这个文件.
主要活动
public class MainActivity extends Activity {private static final String SERVICE_URL = "http://10.0.2.2:8080/.....";private static final String TAG = "AndroIDRESTClIEntActivity"; /** Called when the activity is first created. */ @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_main); } public voID retrIEveSampleData(VIEw vw) { EditText IDTxt = (EditText) findVIEwByID(R.ID.ID_textfIEld); String ID = IDTxt.getText().toString(); String sampleURL = SERVICE_URL +"daten/"+ID ; Log.d("getrespond()", "service calling");String url =sampleURL; RestClIEnt clIEnt = new RestClIEnt(url); try{ clIEnt.Execute(RestClIEnt.RequestMethod.GET,this.getApplicationContext()); } catch (Exception e) { String error = String.valueOf(e); Log.d("**********clIEnt.Execute(RequestMethod.GET);***********",error); } try { if(clIEnt.getResponseCode() == 200) { Log.d("Response is 200", String.valueOf(clIEnt.getResponse().length())); System.out.println(this.getfilesDir().getPath().toString()); file daten= clIEnt.getResponse(); System.out.println(daten.getname()); Toast.makeText(this.getApplicationContext(), "Responce is "+String.valueOf(clIEnt.getResponseCode()), 2000).show(); } else { String error = String.valueOf(clIEnt.getResponse()); Log.d("Response*********** not 200 ************", String.valueOf(clIEnt.getResponse())); } }catch (Exception e) { e.printstacktrace(); Log.d("EXCEPTIONI IS 3", e.toString()); // Todo: handle exception } startActivity(new Intent("androID.intent.action.liNEGRAPH"));
我从主要开始的另一项活动:
public class lineGraph extends Activity{ @OverrIDe public voID onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVIEw(R.layout.activity_line_graph); } @OverrIDe protected voID onResume() { super.onResume(); if (mChartVIEw == null) { linearLayout layout = (linearLayout) findVIEwByID(R.ID.chart); try { mChartVIEw = ChartFactory.getlineChartVIEw(this, getDemoDataset(), getDemoRenderer()); } catch (IOException e) { // Todo auto-generated catch block e.printstacktrace(); } layout.addVIEw(mChartVIEw, new LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT)); } else { mChartVIEw.repaint(); } }
的Manifest.xml
<manifest xmlns:androID="http://schemas.androID.com/apk/res/androID" package="com.praktikum.androIDcrestclIEnt" androID:versionCode="1" androID:versionname="1.0" > <uses-sdk androID:minSdkVersion="8" androID:targetSdkVersion="15" /> <uses-permission androID:name="androID.permission.ACCESS_NETWORK_STATE" > </uses-permission> <uses-permission androID:name="androID.permission.INTERNET" > </uses-permission> <uses-permission androID:name="androID.permission.WRITE_INTERNAL_STORAGE" /> <uses-permission androID:name="androID.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission androID:name="androID.permission.READ_CONTACTS" /> <application androID:icon="@drawable/ic_launcher" androID:label="@string/app_name" androID:theme="@style/Apptheme" > <activity androID:name=".MainActivity" androID:label="@string/Title_activity_main" > <intent-filter> <action androID:name="androID.intent.action.MAIN" /> <category androID:name="androID.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity androID:name="com.praktikum.androIDcrestclIEnt.lineGraph" androID:label="@string/Title_activity_line_graph" > <intent-filter> <action androID:name="androID.intent.action.liNEGRAPH" /> <category androID:name="androID.intent.category.DEFAulT" /> </intent-filter> </activity> <activity androID:name="org.achartengine.GraphicalActivity"/> </application></manifest>
在这里我的LogCat
10-08 09:23:10.140: D/AndroIDRuntime(4706): Shutting down VM10-08 09:23:10.140: W/dalvikvm(4706): threadID=1: thread exiting with uncaught exception (group=0x40015560)10-08 09:23:10.161: E/AndroIDRuntime(4706): FATAL EXCEPTION: main10-08 09:23:10.161: E/AndroIDRuntime(4706): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.praktikum.androIDcrestclIEnt/com.praktikum.androIDcrestclIEnt.lineGraph}: java.lang.classNotFoundException: com.praktikum.androIDcrestclIEnt.lineGraph in loader dalvik.system.PathClassLoader[/data/app/com.praktikum.androIDcrestclIEnt-1.apk]10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1569)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread.access00(ActivityThread.java:117)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread$H.handleMessage(ActivityThread.java:931)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.os.Handler.dispatchMessage(Handler.java:99)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.os.Looper.loop(Looper.java:123)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread.main(ActivityThread.java:3683)10-08 09:23:10.161: E/AndroIDRuntime(4706): at java.lang.reflect.Method.invokeNative(Native Method)10-08 09:23:10.161: E/AndroIDRuntime(4706): at java.lang.reflect.Method.invoke(Method.java:507)10-08 09:23:10.161: E/AndroIDRuntime(4706): at com.androID.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)10-08 09:23:10.161: E/AndroIDRuntime(4706): at com.androID.internal.os.ZygoteInit.main(ZygoteInit.java:597)10-08 09:23:10.161: E/AndroIDRuntime(4706): at dalvik.system.NativeStart.main(Native Method)10-08 09:23:10.161: E/AndroIDRuntime(4706): Caused by: java.lang.classNotFoundException: com.praktikum.androIDcrestclIEnt.lineGraph in loader dalvik.system.PathClassLoader[/data/app/com.praktikum.androIDcrestclIEnt-1.apk]10-08 09:23:10.161: E/AndroIDRuntime(4706): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240)10-08 09:23:10.161: E/AndroIDRuntime(4706): at java.lang.classLoader.loadClass(ClassLoader.java:551)10-08 09:23:10.161: E/AndroIDRuntime(4706): at java.lang.classLoader.loadClass(ClassLoader.java:511)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.Instrumentation.newActivity(Instrumentation.java:1021)10-08 09:23:10.161: E/AndroIDRuntime(4706): at androID.app.ActivityThread.performlaunchActivity(ActivityThread.java:1561)10-08 09:23:10.161: E/AndroIDRuntime(4706): ... 11 more10-08 09:23:10.180: W/ActivityManager(89): Force finishing activity com.praktikum.androIDcrestclIEnt/.lineGraph10-08 09:23:10.180: W/ActivityManager(89): Force finishing activity com.praktikum.androIDcrestclIEnt/.MainActivity10-08 09:23:10.690: W/ActivityManager(89): Activity pause timeout for HistoryRecord{4094eea0 com.praktikum.androIDcrestclIEnt/.lineGraph}10-08 09:23:12.330: I/Process(4706): Sending signal. PID: 4706 SIG: 910-08 09:23:12.350: I/ActivityManager(89): Process com.praktikum.androIDcrestclIEnt (pID 4706) has dIEd.10-08 09:23:12.360: E/inputdispatcher(89): channel '4065ae98 com.praktikum.androIDcrestclIEnt/com.praktikum.androIDcrestclIEnt.MainActivity (server)' ~ Consumer closed input channel or an error occurred. events=0x810-08 09:23:12.360: E/inputdispatcher(89): channel '4065ae98 com.praktikum.androIDcrestclIEnt/com.praktikum.androIDcrestclIEnt.MainActivity (server)' ~ Channel is unrecoverably broken and will be disposed!10-08 09:23:12.490: I/WindowManager(89): WIN DEATH: Window{4065ae98 com.praktikum.androIDcrestclIEnt/com.praktikum.androIDcrestclIEnt.MainActivity paused=true}10-08 09:23:12.500: I/WindowManager(89): WIN DEATH: Window{406c1140 Toast paused=false}10-08 09:23:12.600: W/inputManagerService(89): Got remoteexception sending setActive(false) notification to pID 4706 uID 1003410-08 09:23:12.660: E/inputdispatcher(89): Received spurIoUs receive callback for unkNown input channel. fd=168, events=0x810-08 09:23:16.820: D/dalvikvm(396): GC_EXPliCIT freed 7K, 54% free 2537K/5511K, external 1625K/2137K, paused 43ms10-08 09:23:21.626: W/ActivityManager(89): Activity destroy timeout for HistoryRecord{4094e768 com.praktikum.androIDcrestclIEnt/.MainActivity}10-08 09:23:21.626: W/ActivityManager(89): Activity destroy timeout for HistoryRecord{4094eea0 com.praktikum.androIDcrestclIEnt/.lineGraph}10-08 09:23:21.900: D/dalvikvm(299): GC_EXPliCIT freed 12K, 55% free 2589K/5703K, external 1625K/2137K, paused 73ms10-08 09:23:26.950: D/dalvikvm(407): GC_EXPliCIT freed 4K, 55% free 2532K/5511K, external 1625K/2137K, paused 57ms10-08 09:24:54.097: D/SntpClIEnt(89): request time Failed: java.net.socketException: Address family not supported by protocol10-08 09:29:54.106: D/SntpClIEnt(89): request time Failed: java.net.socketException: Address family not supported by protocol10-08 09:34:54.130: D/SntpClIEnt(89): request time Failed: java.net.socketException: Address family not supported by protocol
你能帮我找一下为什么它找不到这个其他的活动.
谢谢
解决方法:
在此声明中将类的名称更改为“lineGraph”而不是“lineGraph”:
public class lineGraph extends Activity{
总结 以上是内存溢出为你收集整理的android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException全部内容,希望文章能够帮你解决android – java.lang.RuntimeException:无法实例化活动ComponentInfo … java.lang.ClassNotFoundException所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)