简体   繁体   中英

Could not identify launch activity: Default Activity not found Error while Launching activity

I am new in android studio and having this error when i try to run my app. i looked for solution but can't fix it. i am trying gmail login in my app. i changed in build gradle

compile 'com.google.android.gms:play-services:6.1.11'

to

     compile 'com.google.android.gms:play-services:8.3.0'

error 在此处输入图片说明

Manifest is as below

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />
<application
    android:name=".MytestApp"
    android:allowBackup="true"
    android:icon="@drawable/logo"
    android:label="@string/app_name"
    android:supportsRtl="true"
    android:theme="@style/AppTheme" />
<meta-data
    android:name="com.facebook.sdk.ApplicationId"
    android:value="@string/app_id" />
<provider
    android:name="com.facebook.FacebookContentProvider"
    android:authorities="com.facebook.app.FacebookContentProvider572987599539975"
    android:exported="true" />
<activity
    android:name=".MainActivity"
    android:label="Home"
    android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity
    android:name=".LoginActivity"
    android:label="Login">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
<activity
    android:name=".SplashActivity"
    android:label="@string/app_name">
</activity>
<activity android:name=".GoogleActivity"/>
<activity
    android:name="com.facebook.FacebookActivity"                      android:configChanges="keyboard|keyboardHidden|screenLayout|screenSize|orientation"
    android:label="@string/app_name"
    android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data
    android:name="com.google.android.gms.version"
    android:value="@integer/google_play_services_version" />
</manifest>

Build Gradle

android {
compileSdkVersion 24
buildToolsVersion "24.0.1"

defaultConfig {
    applicationId "com.example.bishnu.mylifemarkapp"
    minSdkVersion 15
    targetSdkVersion 24
    versionCode 1
    versionName "1.0"
    multiDexEnabled true
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'com.android.support:multidex:1.0.1'
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:24.2.0'
compile 'com.android.support:design:24.2.0'

compile 'com.google.android.gms:play-services:8.3.0'
}

Close you <application> tag after declaring all activities. I could find that you closed it before declaring the activities. From your image posted it is clear that android:exported="true" /> you have closed the tag.

Clean Project or rebuild project then run its run successfully. Basically its problem occur due to instant run. So you can disable run for avoid this problem https://developer.android.com/studio/run/index.html

It seems you have registered all activities inside manifest tag. That's not correct, Add all activities inside Application Tag.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"  
    package="com.javatpoint.hello"  
    android:versionCode="1"  
    android:versionName="1.0" >  

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

    <application  
        android:icon="@drawable/ic_launcher"  
        android:label="@string/app_name"  
        android:theme="@style/AppTheme" >  
        <activity  
            android:name=".MainActivity"  
            android:label="@string/title_activity_main" >  
            <intent-filter>  
                <action android:name="android.intent.action.MAIN" />  

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

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