Kala J
Kala J

Reputation: 2070

Default Activity Not Found IntelliJ

When I run my app, I am taken to an Edit Configuration screen and it says, "Default Activity not found". I believe I got this error after I tried to import a library from another app I have.

I keep getting this error even after I rebuilt my project, restarted IntelliJ IDEA and file > Invalidated Cache. I did set a main activity so I'm not sure why it says that.

Here's the exception:

  Process: com.example.Device, PID: 24635
    java.lang.RuntimeException: Unable to instantiate application android.app.Application: java.lang.IllegalStateException: Unable to get package info for com.example.Device; is package not installed?
            at android.app.LoadedApk.makeApplication(LoadedApk.java:507)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
            at android.app.ActivityThread.access$1500(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)
     Caused by: java.lang.IllegalStateException: Unable to get package info for com.example.Device; is package not installed?
            at android.app.LoadedApk.initializeJavaContextClassLoader(LoadedApk.java:368)
            at android.app.LoadedApk.getClassLoader(LoadedApk.java:321)
            at android.app.LoadedApk.makeApplication(LoadedApk.java:500)
            at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4301)
            at android.app.ActivityThread.access$1500(ActivityThread.java:135)
            at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1256)
            at android.os.Handler.dispatchMessage(Handler.java:102)
            at android.os.Looper.loop(Looper.java:136)
            at android.app.ActivityThread.main(ActivityThread.java:5001)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:515)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:785)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
            at dalvik.system.NativeStart.main(Native Method)

I can run my application anyway even though the "configuration is not set" and all is well.

Upvotes: 0

Views: 635

Answers (2)

Tara
Tara

Reputation: 2648

If it shows Edit configuration Screen and Error as "Default activity not found" then go to your manifest file and in activity tag which will be your launching activity name should be like "packageName.MainActivty" instead of ".MainActivity" see below code for your reference

<activity
    android:name="com.your.package.name.YourActivity"
    android:label="@string/app_name">
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

Upvotes: 1

danysz
danysz

Reputation: 628

  1. Are you capable to "select" the activity from the list of activities ?
  2. There is an activity defined in AndroidManifest as the main activity (launcher)

Upvotes: 1

Related Questions