[英]Android Error “Application not installed”
I am using Droid X to test my application and it was working fine until I added several Activities to my application, the error says "Application not installed". 我正在使用Droid X测试我的应用程序,并且在向我的应用程序中添加了几个“活动”之前,它一直运行良好,错误消息为“未安装应用程序”。 I added few Activities that uses WebView, the code is below. 我添加了一些使用WebView的活动,代码如下。 I noticed that whenever I removed these Activities or remove just SOME of them, the app starts working again. 我注意到,无论何时删除这些活动或仅删除其中的一些活动,该应用程序都将再次开始工作。 I have added the following permissions below in my Manifest. 我在清单中添加了以下权限。 It has been two days, and I can't still find the answer. 已经两天了,我仍然找不到答案。 I really need your help. 我真的需要你的帮助。 I'm really guessing that the problems comes from too much Activities, but how can I handle it, I added everything that are need in my Manifest and still getting the same error over and over. 我真的在猜测问题来自过多的活动,但是我该如何处理呢?我在清单中添加了所有需要的内容,但仍然反复出现相同的错误。
Here is my manifest.xml 这是我的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>
- Here is my activity: -这是我的活动:
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;
}
}
This occurs when you have declared an activity more than once in your manifest file. 当您在清单文件中多次声明一个活动时,就会发生这种情况。 Remove android:label="@string/app_name">
and try again. 删除android:label="@string/app_name">
然后重试。 You have declared this twice. 您已经声明了两次。 May be this is the reason its not working 可能是这不起作用的原因
I guess the problem can be here: 我想问题可能在这里:
public void onBackPressed(){
Activity2.this.finish();
return;
}
You try to call finish method for Activity2 although you work with Activity3. 您尝试使用Activity2的完成方法,尽管您使用Activity3。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.