V Mircan
V Mircan

Reputation: 578

Android Studio app won't run on my phone anymore but it does on other devices

After a random run, without changing anything, the app I'm developing is no longer running on my phone. I gave it some thought and finally decided to test it on another device only to find out that it works perfectly. Emulators work as well. This is a big bottleneck in my development since I can only use emulators as of now.

This is the error that I'm getting:

Error while executing: am start -n "com.university.hobi_android/com.university.hobi_android.ui.main.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.university.hobi_android/.ui.main.MainActivity } Error type 3 Error: Activity class {com.university.hobi_android/com.university.hobi_android.ui.main.MainActivity} does not exist.

Android Studio 3.5.1.

Device is running Android Pie

Here is my manifest file:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
          package="com.university.hobi_android">

    <application
            android:allowBackup="true"
            android:icon="@mipmap/ic_launcher"
            android:label="@string/app_name"
            android:roundIcon="@mipmap/ic_launcher_round"
            android:supportsRtl="true"
            android:theme="@style/AppTheme">
        <activity android:name=".ui.main.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>

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

</manifest>

Upvotes: 0

Views: 522

Answers (2)

V Mircan
V Mircan

Reputation: 578

I figured it out in the end. What I had to do was to go into the build.gradle file of my module and change the applicationId, versionCode and versionName properties. It still doesn't run from android studio for some reason but it installing the app and running it off my phone works now.

Upvotes: 0

Kaushal Panchal
Kaushal Panchal

Reputation: 1825

You need to follow the below steps.

  1. Start Android Studio
  2. Switch the file view from "Android" to "Project" view
  3. Delete .idea
  4. Delete .gradle
  5. Delete all *.iml files
  6. Files -> "Invalidate Caches / Restart"
  7. "Invalidate and Restart"

Note:- Also, Disconnect the physical device and reconnect the device.

Upvotes: 1

Related Questions