1
votes

It works fine in nougat and below. But gives Error type 3 - Error while Launching activity in Oreo. How can I fix it?

Manifest

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

    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

    <application
        android:allowBackup="false"
        android:icon="@mipmap/logo_launcher"
        android:label="@string/app_name"
        android:largeHeap="true"
        android:roundIcon="@mipmap/logo_round_launcher"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

        <activity
            android:name=".LiveTrack"
            android:label="@string/title_activity_live_track"
            android:screenOrientation="portrait"
            android:theme="@style/AppTheme.NoActionBar" />

        <receiver
            android:name=".YourActivityRunOnStartup"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>

        <receiver
            android:name=".ShutDownReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="android.intent.action.ACTION_SHUTDOWN" />
            </intent-filter>
        </receiver>

        <service
            android:name=".MyJobService"
            android:permission="android.permission.BIND_JOB_SERVICE" />
    </application>

</manifest>

Build.gradle

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.1"
    defaultConfig {
        applicationId "com.zzz.com.z"
        minSdkVersion 21
        targetSdkVersion 26
        versionCode 1
        versionName "1.01"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile 'com.android.support:design:26.+'
    compile 'com.google.android.gms:play-services-location:11.0.4'
    compile 'com.android.support:support-vector-drawable:26.+'
    testCompile 'junit:junit:4.12'
}

Error:

Error while executing: am start -n "com.zzz.com.z/com.zzz.com.z.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.zzz.com.z/.MainActivity } Error type 3 Error: Activity class {com.zzz.com.z/com.zzz.com.z.MainActivity} does not exist.

Error while Launching activity

1
Clean the project, delete the build directory from root and app folder , restart android studio, rebuild and run. - Mohit
No, it doesn't solve the problem.. It works fine in nougat and marshmallow devices but the problem exists only in oreo - Amrita Stha
your package name is "com.zzz.com.z"; a more standard package name would be "com.zzz.com" - King of Masses
Will that cause the problem? - Amrita Stha

1 Answers

0
votes

The problem could be in your Manifest file. Check AndroidManifest.xml file.

Check the presence of those intent-filters inside your Activity declaration. Like below.

<activity
     android:name=".main.SplashScreenActivity"       
     android:label="@string/app_name"
     android:screenOrientation="portrait">
     <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
     </intent-filter>
 </activity>

If this information is there, maybe some cache problem occurred. Then, try this:

Go to File -> Invalidate Caches / Restart...