简体   繁体   English

无法在我的设备中启动Android App

[英]Can't launch Android App in my device

I'm trying to run App that has a search in its action bar and also it shares in twitter. 我正在尝试在其操作栏中运行具有搜索功能的App,并且它也在twitter中共享。 When I run my App, I got this message in console 当我运行我的应用程序时,我在控制台中收到此消息

 Application already deployed. No need to reinstall.
 \Healthy_Tips2\bin\Healthy_Tips2.apk installed on device
 Done!

But I can't find my App with Apps menu in the device and the App is not launching.. 但我无法在设备中找到应用程序菜单中的应用程序且应用程序未启动..

The following is the code of my start activity manifest.xml 以下是我的启动活动manifest.xml的代码

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

            <action android:name="android.intent.action.SEARCH" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:host="com.emy.healthytips.MainActivity"
                android:scheme="oauth" />
        </intent-filter>

        <meta-data android:name="android.app.searchable"
          android:resource="@xml/searchable"/>

        <!-- enable the base activity to send searches to itself -->
        <meta-data
            android:name="android.app.default_searchable"
            android:value=".MainActivity" />

    </activity>

Go to Project -> clean -> run your project. 转到项目 - >清理 - >运行您的项目。

this will rebuild your project. 这将重建您的项目。

Then run your project again. 然后再次运行您的项目。 Usually works. 通常有效。 Or else are you sure you are not trying to run a library Project?? 或者你确定你没有尝试运行库项目?

Use adb to uninstall your application: 使用adb卸载您的应用程序:

adb uninstall package_name

See link: http://adbshell.com/commands/adb-uninstall/how-to-use-adb-uninstall.html 请参阅链接: http//adbshel​​l.com/commands/adb-uninstall/how-to-use-adb-uninstall.html

Edit: Go to sdk/platformtools under command line tool. 编辑:转到命令行工具下的sdk / platformtools。 And write this line: 写下这一行:

adb uninstall <package_name>

Make any change to your app. 对您的应用进行任何更改。 add a comment or so, or uninstall your app then deploy again. 添加评论左右,或卸载您的应用,然后再次部署。

Aside from uninstalling the previous app through adb like the others have already mentioned. 除了像其他人已经提到的那样通过adb卸载以前的应用程序。

In your manifest, you should increment your versionCode="1" by 1 more and break down your intent filter into two. 在清单中,你应该将你的versionCode =“1”增加1并将你的意图过滤器分解为两个。 This will still work. 这仍然有效。 An activity can have more than one intent-filter. 一个活动可以有多个intent-filter。

<intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
            <action android:name="android.intent.action.SEARCH" />
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data
                android:host="com.emy.healthytips.MainActivity"
                android:scheme="oauth" />
</intent-filter>

I get this error when I try running my app without making changes when the app is already open. 当我在应用程序已经打开时尝试运行我的应用程序而不进行更改时,我收到此错误。

Try closing/restarting your emulator/phone and reopening it. 尝试关闭/重新启动模拟器/手机并重新打开它。

Also try making a change to the app, then deleting it and save it (type "A" anywhere in the code then remove it). 还尝试对应用程序进行更改,然后将其删除并保存(在代码中的任何位置键入“A”,然后将其删除)。

Then try cleaning your project: project > clean 然后尝试清理项目:项目>清理

If that doesn't work, try uninstalling the app after trying above methods and try again. 如果这不起作用,尝试在尝试上述方法后卸载应用程序,然后重试。 This should work. 这应该工作。

I personally always have the same problem, when I'm trying to install an apk via phone, although it's already installed via PC. 我个人总是遇到同样的问题,当我试图通过手机安装apk时,虽然它已经通过PC安装了。 For me it works to simply deinstall the final app and try once more to install the apk. 对我来说,只需卸载最终应用程序并尝试再次安装apk即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM