![](/img/trans.png)
[英]I often found this specific error: “Could not identify launch activity: Default Activity not found Error while Launching activity”
[英]Could not identify launch activity: Default Activity not found Error while Launching activity
我是android studio的新手,尝试运行我的应用时遇到此错误。 我正在寻找解决方案,但无法解决。 我正在尝试在我的应用程序中使用gmail登录。 我改变了构建gradle
compile 'com.google.android.gms:play-services:6.1.11'
至
compile 'com.google.android.gms:play-services:8.3.0'
清单如下
<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>
建立摇篮
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'
}
声明所有活动后,关闭您的<application>
标记。 我可以发现您在宣布活动之前将其关闭。 从发布的图片中可以明显看出,您已经关闭了android:exported="true" />
。
清理项目或重建项目,然后成功运行。 基本上,它的问题是由于即时运行而发生的。 因此,您可以禁用运行以避免此问题https://developer.android.com/studio/run/index.html
看来您已将所有活动注册在manifest标签内。 这是不正确的,请在“应用程序标记”中添加所有活动。
<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.