[英]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. 我是android studio的新手,尝试运行我的应用时遇到此错误。 i looked for solution but can't fix it.
我正在寻找解决方案,但无法解决。 i am trying gmail login in my app.
我正在尝试在我的应用程序中使用gmail登录。 i changed in build gradle
我改变了构建gradle
compile 'com.google.android.gms:play-services:6.1.11'
to 至
compile 'com.google.android.gms:play-services:8.3.0'
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. 声明所有活动后,关闭您的
<application>
标记。 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. 从发布的图片中可以明显看出,您已经关闭了
android:exported="true" />
。
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
因此,您可以禁用运行以避免此问题https://developer.android.com/studio/run/index.html
It seems you have registered all activities inside manifest tag. 看来您已将所有活动注册在manifest标签内。 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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.