Recently after upgrading Android Studio to version 4.x, I found some of my old Android projects showing a warning message: "Warning: Default Activity not found" when I tried to run the project in the emulator; and Android Studio would not be able to launch the app.
I tried the following:
- Build | Clean project in Android Studio
- Invalidate Caches / Restart in Android Studio
- Verified AndroidManifest.xml is declaring the main activity correctly
- Deleted the Android Studio caches - .idea/, .gradle/, *.iml
None worked.
When I tried to edit the run configuration, no matter what launch options I chose, the warning message still persisted, as shown in the screenshot below and I could not run the application.
Finally, systematically I discovered the problem to be related to the Google Play Services AdMob dependency. The app's build.gradle snippet below shows the dependency.
dependencies {
implementation 'com.google.android.gms:play-services-ads:19.3.0' }
Note: When using the newer Google Play Services Ads, the minimum SDK must now be set to at least 16.
The screenshot below shows the Android Studio project when using 14 as the minimum SDK level. Notice the large red cross.
No comments:
Post a Comment