When I try to run my application it appears Error running 'app': Default Activity not found
, however my AndroidManifestx.ml I think is fine since it has not given me any problems before and I have not made changes to this file, I just suddenly got the error.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.ziceck.appgaci001">
<!-- To auto-complete the email text field in the login form with the user's emails -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_PROFILE" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
<application
android:name=".Initializer"
android:allowBackup="true"
android:icon="@mipmap/logo"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:hardwareAccelerated="false"
android:largeHeap="true">
<activity android:name=".activities.HomeActivity">
</activity>
<activity android:name=".activities.LoginActivity"
android:noHistory="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".activities.ProyectoActivity" />
<activity android:name=".activities.ProjectsActivity" />
<activity android:name=".activities.ParticipantsActivity" />
<activity android:name=".activities.ActivitiesActivity" />
<activity android:name=".activities.RepliesActivity" />
</application>
</manifest>
I also already tried the option File -> Invalidate Cache / Restart
, but the error persists.
I also tried to do it from Run/Debug Configurations con Specified Activity
but it says that the activity is not declared in the manifest, in fact it doesn't recognize any activity.
build.gradle (Module: app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 27
defaultConfig {
applicationId "io.github.ziceck.appgaci001"
minSdkVersion 19
targetSdkVersion 27
versionCode 1
versionName "2018.12.05"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support:design:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.android.volley:volley:1.1.0'
implementation 'com.android.support:cardview-v7:27.1.1'
implementation 'net.gotev:uploadservice:3.4.2'
implementation 'com.github.chrisbanes:PhotoView:2.1.3'
implementation 'de.hdodenhof:circleimageview:2.2.0'
}
build.gradle(Prohe)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
mavenCentral()
maven { url "https://jitpack.io" }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
In the configuration select
Launch
:Default Activity
, in this way it will take the configuration defined in the AndroidManifest.xml which in this case would be to openEnsures to rebuild the project
Invalidating the cache may also work, go to the Android Studio menu:
File
>Invalidate Caches / Restart...
The same thing happened to me and the only thing that worked for me was to do the following: