2012-11-05 101 views
0

你好我所有新的android開發我收到以下錯誤任何幫助嗎? 由於事先Webview Android應用程序關閉

package com.example.gossipmate.mobi; 
import android.os.Bundle; 
import android.app.Activity; 
import android.view.Window; 
import android.webkit.WebChromeClient; 
import android.webkit.WebView; 
import android.webkit.WebViewClient; 

public class Gossipmate extends Activity 
{ 
    final Activity activity = this; 

    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     this.getWindow().requestFeature(Window.FEATURE_PROGRESS); 
     setContentView(R.layout.activity_gossip_mate); 
     final WebView webView = (WebView) findViewById(R.id.webview); 
     webView.getSettings().setJavaScriptEnabled(true); 
     webView.setWebChromeClient(new WebChromeClient() { 
      public void onProgressChanged(WebView view, int progress) { 
       activity.setTitle("Loading"); 
       activity.setProgress(progress * 100); 

       if (progress == 100) 
        activity.setTitle(R.string.app_name); 
      } 

     }); 
     webView.setWebViewClient(new WebViewClient() { 
      @Override 
      public void onReceivedError(WebView view, int errorCode, 
        String description, String failingUrl) { 
       // Handle the error 
      } 

      @Override 
      public boolean shouldOverrideUrlLoading(WebView view, String url) { 
       view.loadUrl(url); 
       return true; 
      } 

     }); 

     webView.loadUrl("http://www.gossipmate.x10.bz"); 

    }} 

以上是我的應用程序代碼和錯誤顯示如下

11-05 13:34:06.329: W/dalvikvm(595): threadid=1: thread exiting with uncaught exception (group=0x40015560) 
11-05 13:34:06.429: E/AndroidRuntime(595): FATAL EXCEPTION: main 
11-05 13:34:06.429: E/AndroidRuntime(595): java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.gossipmate.mobi/com.example.gossipmate.mobi.GossipMate}: java.lang.ClassNotFoundException: com.example.gossipmate.mobi.GossipMate in loader dalvik.system.PathClassLoader[/data/app/com.example.gossipmate.mobi-1.apk] 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1569) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.os.Handler.dispatchMessage(Handler.java:99) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.os.Looper.loop(Looper.java:123) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.main(ActivityThread.java:3683) 
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.reflect.Method.invokeNative(Native Method) 
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.reflect.Method.invoke(Method.java:507) 
11-05 13:34:06.429: E/AndroidRuntime(595): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 
11-05 13:34:06.429: E/AndroidRuntime(595): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 
11-05 13:34:06.429: E/AndroidRuntime(595): at dalvik.system.NativeStart.main(Native Method) 
11-05 13:34:06.429: E/AndroidRuntime(595): Caused by: java.lang.ClassNotFoundException: com.example.gossipmate.mobi.GossipMate in loader dalvik.system.PathClassLoader[/data/app/com.example.gossipmate.mobi-1.apk] 
11-05 13:34:06.429: E/AndroidRuntime(595): at dalvik.system.PathClassLoader.findClass(PathClassLoader.java:240) 
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.ClassLoader.loadClass(ClassLoader.java:551) 
11-05 13:34:06.429: E/AndroidRuntime(595): at java.lang.ClassLoader.loadClass(ClassLoader.java:511) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.Instrumentation.newActivity(Instrumentation.java:1021) 
11-05 13:34:06.429: E/AndroidRuntime(595): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1561) 
11-05 13:34:06.429: E/AndroidRuntime(595): ... 11 more 
11-05 13:34:06.539: W/ActivityManager(61): Force finishing activity com.example.gossipmate.mobi/.GossipMate 
11-05 13:34:07.109: W/ActivityManager(61): Activity pause timeout for HistoryRecord{406d08c8 com.example.gossipmate.mobi/.GossipMate} 

清單文件

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.gossipmate.mobi" 
android:versionCode="1" 
android:versionName="1.0" > 

<uses-sdk 
    android:minSdkVersion="10" 
    android:targetSdkVersion="15" /> 

<uses-permission android:name="android.permission.INTERNET" > 
</uses-permission> 

<application 
    android:icon="@drawable/ic_launcher" 
    android:label="@string/app_name" 
    android:theme="@style/AppTheme" > 
    <activity 
     android:name=".GossipMate" 
     android:label="@string/title_activity_gossip_mate" > 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 
</application> 

上面是明顯的代碼我是使用我相信我已經註冊了活動

該應用程序現在正在工作,沒有問題後,我與M改變了M,並開始一個新的項目。

+0

什麼是你想在web視圖辦? –

+0

先編輯你的代碼,然後錯誤。沒有人可以找出你的問題與出代碼。首先 –

+0

我只是想在webview中顯示一個網站 我想編輯帖子並添加我的代碼,但它顯示顯示錯誤說不能發佈 –

回答

1

檢查你的活動名稱的清單文件,其錯誤拼寫。 它應該是Gossipmate而不是GossipMate

UPDATE

嘗試把這一行,而不是您的清單android:name="com.example.gossipmate.mobi.Gossipmate"android:name=".GossipMate"

+0

是的,我已將它更改爲

+0

您可以使用logcat更新您的問題......以便清楚。請更新您的logcat。 – Antrromet

+0

開始一個新項目並將您的代碼粘貼到該新項目中,然後重試。嘗試不同的軟件包名稱和類名稱,然後複製代碼。 – Antrromet

0

在你的AndroidManifest.xml.活動的名稱是android:name=".GossipMate"與隊友是m是大寫字母,其中在該活動是Gossipmate !!!

檢查java.lang.RuntimeException: Unable to instantiate activity ComponentInfo

+0

謝謝我已經添加了清單代碼 –

+0

檢查java.lang.RuntimeException:無法實例化活動ComponentInfo,可能是其中一個答案將有助於你 – Nermeen

+0

我已經添加了java編碼那有什麼問題嗎? –