“Default Activity Not Found” on Android Studio upgrade

后端 未结 30 1933
时光说笑
时光说笑 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:50

    You app have launch activity default?

    possibly this could be your mistake

    Step 1: Select Edit Configurations

    Step 2: watch this warning: Default Activity not found

    Step 3: select a default activity

    Step 3: Save your changes and finish

    Good Luck

    0 讨论(0)
  • 2020-11-22 05:51

    If you see that error occur after upgrading versions of IntelliJ IDEA or Android Studio, or after Generating a new APK, you may need to refresh the IDE's cache.

    File -> Invalidate Caches / Restart...
    
    0 讨论(0)
  • 2020-11-22 05:51

    In my case I refactored a member variable that was named "activity", I renamed it to "context"... I found out that the refactor was made to the activity tags in manifest, and I found them context tags instead... this is really stupid from Android Studio!

    0 讨论(0)
  • 2020-11-22 05:53

    Try to right click on the project and choose Open Module Settings. Then go to the Sources tab in your module, find the src folder, right click on it and mark it as Sources (blue color).

    EDIT: There is no sources tab in later versions of Android Studio, but you can edit the build.gradle file instead: https://stackoverflow.com/a/22028681/1101730

    0 讨论(0)
  • 2020-11-22 05:54

    Sync Project With Gradle Files works sometimes, To fix this Overall issue you should

    1. Exit Android Studio
    2. Go to USER -> AndroidStudio -> system -> caches
    3. Delete that folder
    4. Start Android Studio.

    It will re-index your files and that should work

    Thanks to kirtan403 from a similar question.

    0 讨论(0)
  • 2020-11-22 05:57

    This method works for me Click on the app icon and then choose edit configurations. In the edit-configuration choose specified activity instead of the default activity. Then give the path of the activity below.

    In the end sync with the gradle files.

    0 讨论(0)
提交回复
热议问题