Error type 3: Activity Class {…} does not exist

2019-01-06 19:10发布

AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.m.e"
      android:versionCode="5"
      android:versionName="3.0">

<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18"/>

<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
    <activity
            android:name="com.m.e"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action
                    android:name="android.intent.action.MAIN"
                    />

            <category android:name="android.intent.category.LAUNCHER"/>
        </intent-filter>
    </activity>
    <activity
            android:name="com.m.e"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden">
        <intent-filter>
            <action
                    android:name="android.intent.action.first"
                   />

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

    .....

</application>

</manifest>

Error :

 Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] cmp=com.m.e/.Splash }
 Error type 3
 Error: Activity class {com.m.e/com.m.e.Splash} does not exist.

Note: .Splash does exist.

22条回答
干净又极端
2楼-- · 2019-01-06 19:42

I tried all of the suggestions above, but only that solved my problem;

  1. Change package name irrelevant one and sync gradle.
  2. Change package name to really you want, sync and run.
查看更多
地球回转人心会变
3楼-- · 2019-01-06 19:43

Your error states that it is looking for com.codealchemist.clashmma.splash. Most Java classes start with an uppercase letter - make sure your class name matches exactly.

查看更多
【Aperson】
4楼-- · 2019-01-06 19:44

Although it's a question posted years ago, I would like to share my solution.

Open Run->Edit Configuration, check if "Deploy default APK" is chosen in the package panel. "Deploy default APK" should be chosen.

The problem occurs to me because I choose "Do not deploy anything" earlier for some reason and I forget to undo the chosen.

查看更多
太酷不给撩
5楼-- · 2019-01-06 19:44

Check if you are building hidden version. That’s intended behavior for hidden app.

If you want to build regular version, you need to change Build Variant in Android Studio Build > Select Build Variant, change it to regular.

查看更多
登录 后发表回答