“Default Activity Not Found” on Android Studio upgrade

后端 未结 30 2348
时光说笑
时光说笑 2020-11-22 05:08

I upgraded IntelliJ Idea from 12.0.4 to 12.10.

Now all the modules in my Android project give the error:

Error: Default Activity Not Found

30条回答
  •  青春惊慌失措
    2020-11-22 05:57

    Since Android Studio 3.5 or 3.6 I started getting the Default Activity not found and I became tired of Invalidating Caches & Restart, rebuilding project etc.

    It turned out, the way I handle multi-modules and manifests was erroneous. I had the default Activity's Manifest in library module only, but it should've been in both app modules.

    Assuming librarymodule appmodule1 appmodule2

    1. Remove HomeActivity from librarymodule Manifest whatsoever.
    2. Add:
    class AppModuleActivity1 : HomeActivity() to appmodule1
    class AppModuleActivity2 : HomeActivity() to appmodule2
    
    1. To appmodule1 Manifest inside application tag, I added:
            
                
                    
                    
                
            
    
    1. Same about appmodule2 but change 2 for 1 in naming.

提交回复
热议问题