Android: Unable to instantiate application

前端 未结 11 1484
别跟我提以往
别跟我提以往 2021-01-03 23:40

I renamed my package and now I get this strange error:

Unable to instantiate application
app.MyApplication: java.lan         


        
相关标签:
11条回答
  • 2021-01-04 00:11

    For me the issue was due to access level of the class, it has to be public

    0 讨论(0)
  • 2021-01-04 00:15

    this answer helped me, basically rename your lib to libs if you're using SDK 17+ https://stackoverflow.com/a/10176048/46459

    0 讨论(0)
  • 2021-01-04 00:15

    I faced this issue as long as a day, finally i solved it, I had a mistake in Application class declaration, you need set your application class public like this:

    public class AppController extends Application { }

    My code that is wrong: class AppController extends Application { }

    0 讨论(0)
  • 2021-01-04 00:18

    For me, the issue was with instant-run. Disabling it solved the issue.

    Will update if I find a solution for re-enabling and making it work.

    0 讨论(0)
  • 2021-01-04 00:19

    Simple clean the project and rebuild.

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