安装后,Android 应用程序无法打开.但它可以在模拟器中运行 [英] Android app won't open after i install. But it can run in emulator

查看:20
本文介绍了安装后,Android 应用程序无法打开.但它可以在模拟器中运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已从 Eclipse 导出我的应用程序并将其安装在我的手机上.安装后,我从包安装程序中单击打开,但安装程序强制关闭.之后,当我尝试启动该应用程序时,单击它后没有任何反应.我在应用程序抽屉中点击了该应用程序,但它反而返回了主屏幕.

I have exported my app from eclipse and installed it on my phone. After installation, I click open from package installer, but the installer force close. Afterwards, when I tried to launch the app, nothing happen after I click it. I click the app in app drawer but it return to home screen instead.

当我通过 USB 连接我的设备时,我能够在模拟器和调试模式下运行,但当我导出 apk 进行安装时则不能.

I am able to run in emulator and in debug mode when I connect my device via usb, but not when I export the apk to install.

请注意,这不是我导出安装的第一个应用程序.以前的应用运行良好.

Note that this is not the first app that I exported to install. Previous apps are working fine.

推荐答案

我发现了问题!我在清单中使用不同的属性声明了 2 次活动,例如:

I found the problem! I had declared the activity 2 times in the manifest with different properties, like:

<activity android:name=".myclass"></activity> 

<activity android:name=".myclass" android:label="@string/app_name">
  <intent-filter>   
     <action android:name="android.intent.action.MAIN" /> 
     <category android:name="android.intent.category.LAUNCHER" /> 
  </intent-filter>
</activity> 

从清单中删除不需要的,它就会起作用.

Remove the unwanted one from the manifest and it will work.

这篇关于安装后,Android 应用程序无法打开.但它可以在模拟器中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆