Android Studio can't run application on device: stuck on "Waiting for process: <project>"
Asked Answered
M

6

12

When trying to debug my application on my Samsung Galaxy S4, I get this output:

Waiting for device.
Target device: samsung-samsung_sgh_i337-8c8aa2c7
Uploading file
    local path: C:\Users\awebberley\AndroidStudioProjects\Contacts\app\build\apk\app-debug-unaligned.apk
    remote path: /data/local/tmp/org.intracode.contacts
Installing org.intracode.contacts
DEVICE SHELL COMMAND: pm install -r "/data/local/tmp/org.intracode.contacts"
pkg:/data/local/tmp/org.intracode.contacts
Success


Waiting for process: org.intracode.contacts

It just stays on the "waiting for process" message without running the application. I'm new to android development, is there something I'm missing?

FYI, I was able to launch the application in an emulator before, but after I tried this and went back to the emulator, the same "waiting for process" message appeared.

Here's my manifest.xml file:

<?xml version="1.0" encoding="utf-8"?>

<application
    android:debuggable="true"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="org.intracode.contacts.MainActivity"
        android:launchMode="standard"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

And here's the my only java file:

package org.intracode.contacts;

import android.support.v7.app.ActionBarActivity;
import android.os.Bundle;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TabHost;
import android.widget.Toast;


public class MainActivity extends ActionBarActivity {

    EditText nameTxt, phoneTxt, emailTxt, addressTxt;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        nameTxt = (EditText) findViewById(R.id.txtName);
        phoneTxt = (EditText) findViewById(R.id.txtPhone);
        emailTxt = (EditText) findViewById(R.id.txtEmail);
        addressTxt = (EditText) findViewById(R.id.txtAddress);
        TabHost tabHost = (TabHost) findViewById(R.id.tabHost);

        tabHost.setup();

        TabHost.TabSpec tabSpec = tabHost.newTabSpec("Creator");
        tabSpec.setContent(R.id.creator);
        tabSpec.setIndicator("Creator");
        tabHost.addTab(tabSpec);

        tabSpec = tabHost.newTabSpec("List");
        tabSpec.setContent(R.id.tabContactList);
        tabSpec.setIndicator("List");
        tabHost.addTab(tabSpec);

        final Button addBtn = (Button) findViewById(R.id.btnCreate);
        addBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getApplicationContext(), "Your Contact has been created!", Toast.LENGTH_SHORT).show();
            }
        });

        nameTxt.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {

            }

            @Override
            public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
                addBtn.setEnabled(!nameTxt.getText().toString().trim().isEmpty());

            }

                @Override
                public void afterTextChanged(Editable editable) {

            }
        });
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {

        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }

}

Thanks

Mc answered 4/6, 2014 at 16:49 Comment(2)
It looks like it is waiting for your activity to start, have you defined one in your manifest that is "launchable" and that you setup Android Studio to launch?Jurkoic
@Jurkoic I only have a Service and this messages comes...Friedman
A
6

UDPATE: I think I found your problem. After looking at the Manifest, the one anomaly I found that I have not found anywhere else is the line about the Android launchmode.

    android:launchMode="standard"

This seems to be related to the problem and is the first glaring issue that I see with this. Remove it, if it works, feel happy, accept the answer :). Make sure you rebuild the project to ensure that the changes are incorporated.

OLD: I think that this is a problem with the Activity not being registered correctly in the Android Manifest. I would make sure that it is the launch process.

Just to get more information, I would export it to an APK and then run it directly on the device, bypassing the debugger. If you do this test though, make sure you turn debuggable off. Of course do this if the other solution doesn't work and you just want to collect more information about the problem.

Auteur answered 4/6, 2014 at 19:47 Comment(4)
I just posted my manifest file, does it look correct? Or does the problem lie somewhere else?Mc
Unfortunately taking that line out didn't seem to change anything. I've posted my java file for analysis, thanks.Mc
Actually, not sure what I changed but I just rebuilt the project and it's working fine now. Thanks for the input!Mc
Rebuilding the project lets the manifest changes be incorporated, so this is actually the problem.Auteur
R
11

"File" --> "Invalidate Caches / Restart" worked for me like a charm.

Reciprocal answered 8/8, 2016 at 13:29 Comment(1)
Thank you! This did the trick for me, even 8 years later.Timothytimour
A
6

UDPATE: I think I found your problem. After looking at the Manifest, the one anomaly I found that I have not found anywhere else is the line about the Android launchmode.

    android:launchMode="standard"

This seems to be related to the problem and is the first glaring issue that I see with this. Remove it, if it works, feel happy, accept the answer :). Make sure you rebuild the project to ensure that the changes are incorporated.

OLD: I think that this is a problem with the Activity not being registered correctly in the Android Manifest. I would make sure that it is the launch process.

Just to get more information, I would export it to an APK and then run it directly on the device, bypassing the debugger. If you do this test though, make sure you turn debuggable off. Of course do this if the other solution doesn't work and you just want to collect more information about the problem.

Auteur answered 4/6, 2014 at 19:47 Comment(4)
I just posted my manifest file, does it look correct? Or does the problem lie somewhere else?Mc
Unfortunately taking that line out didn't seem to change anything. I've posted my java file for analysis, thanks.Mc
Actually, not sure what I changed but I just rebuilt the project and it's working fine now. Thanks for the input!Mc
Rebuilding the project lets the manifest changes be incorporated, so this is actually the problem.Auteur
L
4

I had the same error after upgrading to a new version of the SDK. After updating my build.gradle from 'com.android.tools.build:gradle:1.0.0-rc2' to 'com.android.tools.build:gradle:1.0.0' and invalidating caches/restart, it's working again.

Larhondalari answered 16/1, 2015 at 21:49 Comment(1)
I was working on it for last 24 hrs and this trick made it. Thanks mate!!Desimone
L
4

In Android Studio, Run->Edit Configuration choose Launch default Activity.

Otherwise, it doesn't even bother to start the application.

Lamasery answered 18/12, 2015 at 16:51 Comment(1)
Specifying the Launch Option as "Default Activity" will not correct the problem where the deployed app via AS insists on launching as attached in debug.Tuppence
P
0

In case , you are importing the project from some folder and android studio shows - " Waiting for process", then this did work for me. I copied the project to C:\Users[your account]\AndroidStudioProjects (this path might be different for different users), and then imported the project from there.

Before doing this, I tried everything like , kill-start server, plugging-unplugging ,reinstalling android, USB tethering mode on in android device etc. etc. , but none of them worked for me.

Pleinair answered 8/11, 2015 at 8:5 Comment(0)
L
0

It's September 7, 2024, and I'm using Android Studio Koala 2024.1.2. Everything was fine until three days ago when I hit this stupid error. Gradle builds were fine, but the app just wouldn’t launch, it was only showing Launching app, but it stuck forever. I wasted three days trying to figure out what the hell was going on. Finally, I found out I had to downgrade Android Studio to version 2024.1.1 patch 2, the Android Gradle plugin to 8.2.2, and Gradle to 8.2.

I had a similar problem back in 2019, which you can check out here: "cannot resolve symbol R" in Android Studio.

After all of this, I just gotta say: fuck you, Google and JetBrains, motherfukka!

enter image description here

Liaison answered 7/9 at 9:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.