简体   繁体   中英

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. 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

  <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 uninstall package_name

See link: http://adbshell.com/commands/adb-uninstall/how-to-use-adb-uninstall.html

Edit: Go to sdk/platformtools under command line tool. 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.

In your manifest, you should increment your versionCode="1" by 1 more and break down your intent filter into two. This will still work. An activity can have more than one 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).

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. For me it works to simply deinstall the final app and try once more to install the apk.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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