2012-01-10 195 views
0

我使用Droid X來測試我的應用程序,它工作正常,直到我添加了幾個活動到我的應用程序,錯誤說「應用程序未安裝」。我添加了一些使用WebView的活動,代碼如下。我注意到,每當我刪除這些活動或刪除其中的一些,該應用程序再次開始工作。我在下面的清單中添加了以下權限。已經兩天了,我仍然無法找到答案。我真的需要你的幫助。我真的在猜測問題來自太多活動,但我該如何處理它,我在Manifest中添加了需要的所有東西,並且一遍又一遍地得到相同的錯誤。Android錯誤「應用程序未安裝」

這裏是我的manifest.xml

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
     package="com.test.cats" 
     android:versionCode="1" 
     android:versionName="1.0"> 

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

    <uses-sdk android:minSdkVersion="8" /> 



    <application android:icon="@drawable/icon" android:label="@string/app_name"> 
     <activity android:name=".MainActivity" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="portrait" 
        android:label="@string/app_name"> 
      <intent-filter> 
       <action android:name="android.intent.action.MAIN" /> 
       <category android:name="android.intent.category.LAUNCHER" /> 
      </intent-filter> 
     </activity> 



     <activity android:name=".Activity1" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity2" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity3" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity4" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity5" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity6" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity7" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity8" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity9" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity10" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 


     <activity android:name=".Activity11" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity12" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity13" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity14" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity15" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity16" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity17" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity18" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity19" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 
     <activity android:name=".Activity20" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen" 
        android:screenOrientation="landscape"/> 


    </application> 
</manifest> 

- 這裏是我的活動:

package com.test.cats; 

import java.lang.reflect.InvocationTargetException; 
import java.lang.reflect.Method; 
import android.app.Activity; 
import android.os.Bundle; 
import android.view.View; 
import android.webkit.WebView; 


public class Activity3 extends Activity { 
    WebView webView; 
    /** Called when the activity is first created. */ 
    @Override 
    public void onCreate(Bundle savedInstanceState) { 
     super.onCreate(savedInstanceState); 
     setContentView(R.layout.webviewlayout); 

     webView = (WebView) findViewById(R.id.webview); 
     webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); 
     webView.getSettings().setJavaScriptEnabled(true); 
     webView.getSettings().setAllowFileAccess(true); 
     webView.getSettings().setPluginsEnabled(true); 
     webView.loadUrl("http://www.mywebsite.com/video.html"); 


    } 

    @Override 
    protected void onPause(){ 
     super.onPause(); 
     callHiddenWebViewMethod("onPause"); 
     webView.pauseTimers(); 
     if(isFinishing()){ 
      webView.loadUrl("about:blank"); 
     }  
    } 

    @Override 
    protected void onResume(){ 
     super.onResume(); 
     callHiddenWebViewMethod("onResume"); 
     webView.resumeTimers(); 


    } 

    private void callHiddenWebViewMethod(String name){ 

     if(webView != null){ 
      try { 
       Method method = WebView.class.getMethod(name); 
       method.invoke(webView); 
      } catch (NoSuchMethodException e) { 
       //Lo.g("No such method: " + name + e); 
      } catch (IllegalAccessException e) { 
       //Lo.g("Illegal Access: " + name + e); 
      } catch (InvocationTargetException e) { 
       //Lo.g("Invocation Target Exception: " + name + e); 

      } 
     } 
     } 


    public void onBackPressed(){ 
     Activity2.this.finish(); 
     return; 
    } 

} 
+0

粘貼日誌。錯誤消息可能會提供線索。 – kosa 2012-01-10 04:25:35

+0

我的錯誤日誌中沒有任何內容。 – Leon 2012-01-10 04:26:29

+0

你的意思是你的[logcat](http://developer.android.com/guide/developing/tools/adb.html#logcat)完全沉默? – dokkaebi 2012-01-10 04:30:37

回答

0

當你在你的清單文件中聲明的活動不止一次發生這種情況。刪除android:label="@string/app_name">並重試。你已經宣佈了兩次。可能這是它不工作

0

的原因我想這個問題可以在這裏:

public void onBackPressed(){ 
    Activity2.this.finish(); 
    return; 
} 

您嘗試致電活性2完成方法,雖然你Activity3工作。