Android错误“应用程序未安装”

时间:2012-01-10 04:21:48

标签: android android-activity webview manifest

我正在使用Droid X测试我的应用程序,它工作正常,直到我向我的应用程序添加了几个活动,错误显示“应用程序未安装”。我添加了几个使用WebView的活动,代码如下。我注意到,每当我删除这些活动或删除其中的一些活动时,应用程序就会重新开始工作。我在我的清单中添加了以下权限。已经两天了,我还是找不到答案。我真的需要你的帮助。我真的猜测问题来自过多的活动,但我怎么能处理它,我在我的清单中添加了所有需要的东西,并且仍然一遍又一遍地得到同样的错误。

这是我的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;
    }

}

2 个答案:

答案 0 :(得分:0)

当您在清单文件中多次声明活动时,会发生这种情况。删除android:label="@string/app_name">然后重试。你已经宣布了两次。可能这是它不起作用的原因

答案 1 :(得分:0)

我想问题可以在这里:

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

尽管您使用Activity3,但您尝试为Activity2调用finish方法。