Android Application ClassNotFoundException, Unable to instantiate application

浪子不回头ぞ 提交于 2019-12-05 05:18:01

Have you declared the package name at the top of your class files?

It should have a package declared at the top of each class file like so:

package com.example;

import ...

public class AcraApplication extends Application {
    ...
}

All of your class files with that package declaration should be in the same directory, src/com/example.

You must also declare your package in your AndroidManifest.xml file as well as all subclasses as <activity ... />

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example"
    ... >

    <application
        ... >
        <activity
            android:name=".AcraApplication"
            ... >
        </activity>
    </application>
</manifest>
anamikap

I also had the same error. Solved it by adding below permission in manifest file.

uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"

Hope this helps. :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!