![](/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.