错误:致:抛出java.lang.ClassNotFoundException [英] Error: caused by: java.lang.Classnotfoundexception
问题描述
我非常新的编码,这是我的第一个应用程序。这是非常令人沮丧的,当跑步表示,设备或仿真器上应用程序的不幸的是,应用程序的名称已停止的错误走了过来。我相信,(通过观察LogCat中)我已经查明问题的错误抛出java.lang.ClassNotFoundException。请有人可以告诉我怎样才能解决这个问题。
这是我的清单文件
< XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=http://schemas.android.com/apk/res/android
包=com.benchaful.newboard
安卓版code =1
机器人:VERSIONNAME =1.0>
<应用机器人:图标=@可绘制/图标机器人:标签=@字符串/ APP_NAME>
<活动机器人:名称=com.benchaful.newBoard.activity
机器人:标签=@字符串/ APP_NAME
机器人:screenOrientation =画像>
<意向滤光器>
<作用机器人:名称=android.intent.action.MAIN/>
<类机器人:名称=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
<活动机器人:名称=com.google.ads.AdActivity
机器人:configChanges =键盘| keyboardHidden |定位/>
< /用途>
<使用-SDK机器人:targetSdkVersion =16安卓的minSdkVersion =7/>
<使用-权限的Android:名称=android.permission.INTERNET对/>
<使用-权限的Android:名称=android.permission.ACCESS_NETWORK_STATE/>
< /舱单>
这是我的主要布局文件
< XML版本=1.0编码=UTF-8&GT?;
< RelativeLayout的的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:广告=http://schemas.android.com/apk/res/com.benchaful.newboard
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
>
<滚动型的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:ID =@ + ID / scrollview1
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
>
< LinearLayout中的android:layout_width =FILL_PARENT
机器人:ID =@ + ID / home_layout
机器人:方向=垂直
机器人:layout_height =WRAP_CONTENT
机器人:后台=#000000
>
有一些按键位置
<的WebView
机器人:ID =@ + ID / ACCESSKEY
机器人:layout_width =FILL_PARENT
机器人:layout_height =100像素
/>
< / LinearLayout中>
< /滚动型>
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
的xmlns:广告=http://schemas.android.com/apk/res/com.benchaful.newboard
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =WRAP_CONTENT
机器人:后台=#FFFFFF
机器人:重力=底
机器人:layout_alignParentBottom =真
机器人:layout_alignBottom =@ + ID / home_layout
>
< com.google.ads.AdView
的xmlns:广告=http://schemas.android.com/apk/libs/com.google.ads
机器人:ID =@ + ID / AD浏览报
机器人:layout_width =WRAP_CONTENT
机器人:layout_height =WRAP_CONTENT
广告:adUnitId =a151a7cc8c54403
广告:adSize =大旗
/>
< / LinearLayout中>
< / RelativeLayout的>
这是我的LogCat中
06-07 16:35:58.128:E / AndroidRuntime(5925):致命异常:主要
06-07 16:35:58.128:E / AndroidRuntime(5925):java.lang.RuntimeException的:无法实例活动ComponentInfo {com.benchaful.newboard / com.benchaful.newBoard.activity.ComponentInfo}:抛出java.lang.ClassNotFoundException :com.benchaful.newBoard.activity.ComponentInfo
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2045)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread.access $ 700(ActivityThread.java:140)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:1238)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.os.Handler.dispatchMessage(Handler.java:99)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.os.Looper.loop(Looper.java:137)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread.main(ActivityThread.java:4944)
06-07 16:35:58.128:E / AndroidRuntime(5925):在java.lang.reflect.Method.invokeNative(本机方法)
06-07 16:35:58.128:E / AndroidRuntime(5925):在java.lang.reflect.Method.invoke(Method.java:511)
06-07 16:35:58.128:E / AndroidRuntime(5925):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:1038)
06-07 16:35:58.128:E / AndroidRuntime(5925):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
06-07 16:35:58.128:E / AndroidRuntime(5925):在dalvik.system.NativeStart.main(本机方法)
06-07 16:35:58.128:E / AndroidRuntime(5925):抛出java.lang.ClassNotFoundException:产生的原因com.benchaful.newBoard.activity.ComponentInfo
06-07 16:35:58.128:E / AndroidRuntime(5925):在dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-07 16:35:58.128:E / AndroidRuntime(5925):在java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-07 16:35:58.128:E / AndroidRuntime(5925):在java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.Instrumentation.newActivity(Instrumentation.java:1068)
06-07 16:35:58.128:E / AndroidRuntime(5925):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2036)
从的LinearLayout
和 RelativeLayout的
的xmlns:广告=http://schemas.android.com/apk/res/com.benchaful.newboard
I am extremely new to coding, this is my first app. It is very frustrating that when running said app on a device or an emulator the "Unfortunately, app name has stopped" error came up. I believe that (by looking at the LogCat) I have pinpointed the problem to the error "java.lang.ClassNotFoundException". Please can somebody tell me how I can fix this.
This is my manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.benchaful.newboard"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="com.benchaful.newBoard.activity"
android:label="@string/app_name"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation" />
</application>
<uses-sdk android:targetSdkVersion="16" android:minSdkVersion="7" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
This is my main layout file
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.benchaful.newboard"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<LinearLayout android:layout_width="fill_parent"
android:id="@+id/home_layout"
android:orientation="vertical"
android:layout_height="wrap_content"
android:background="#000000"
>
There is some buttons here
<WebView
android:id="@+id/accesskey"
android:layout_width="fill_parent"
android:layout_height="100px"
/>
</LinearLayout>
</ScrollView>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res/com.benchaful.newboard"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffffff"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_alignBottom="@+id/home_layout"
>
<com.google.ads.AdView
xmlns:ads="http://schemas.android.com/apk/libs/com.google.ads"
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
ads:adUnitId="a151a7cc8c54403"
ads:adSize="BANNER"
/>
</LinearLayout>
</RelativeLayout>
And this is my LogCat
06-07 16:35:58.128: E/AndroidRuntime(5925): FATAL EXCEPTION: main
06-07 16:35:58.128: E/AndroidRuntime(5925): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.benchaful.newboard/com.benchaful.newBoard.activity.ComponentInfo}: java.lang.ClassNotFoundException: com.benchaful.newBoard.activity.ComponentInfo
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2045)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2146)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread.access$700(ActivityThread.java:140)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1238)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.os.Handler.dispatchMessage(Handler.java:99)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.os.Looper.loop(Looper.java:137)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread.main(ActivityThread.java:4944)
06-07 16:35:58.128: E/AndroidRuntime(5925): at java.lang.reflect.Method.invokeNative(Native Method)
06-07 16:35:58.128: E/AndroidRuntime(5925): at java.lang.reflect.Method.invoke(Method.java:511)
06-07 16:35:58.128: E/AndroidRuntime(5925): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
06-07 16:35:58.128: E/AndroidRuntime(5925): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
06-07 16:35:58.128: E/AndroidRuntime(5925): at dalvik.system.NativeStart.main(Native Method)
06-07 16:35:58.128: E/AndroidRuntime(5925): Caused by: java.lang.ClassNotFoundException: com.benchaful.newBoard.activity.ComponentInfo
06-07 16:35:58.128: E/AndroidRuntime(5925): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61)
06-07 16:35:58.128: E/AndroidRuntime(5925): at java.lang.ClassLoader.loadClass(ClassLoader.java:501)
06-07 16:35:58.128: E/AndroidRuntime(5925): at java.lang.ClassLoader.loadClass(ClassLoader.java:461)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.Instrumentation.newActivity(Instrumentation.java:1068)
06-07 16:35:58.128: E/AndroidRuntime(5925): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2036)
Remove this line from your LinearLayout
and RelativeLayout
xmlns:ads="http://schemas.android.com/apk/res/com.benchaful.newboard"
这篇关于错误:致:抛出java.lang.ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!