当我运行我的应用程序时,我将进入“编辑配置”屏幕,并显示“未找到默认活动”。我相信在我尝试从其他应用程序导入库后出现此错误。
即使在我重建项目,重新启动IntelliJ IDEA和文件>之后,我仍然会收到此错误。无效的缓存。我确实设置了一个主要活动,所以我不确定为什么会这样说。
以下是例外:
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)
我可以运行我的应用程序,即使“配置没有设置”,一切都很好。
答案 0 :(得分:1)
答案 1 :(得分:0)
如果它显示编辑配置屏幕和错误为“未找到默认活动”,则转到清单文件和活动标记,这将是您的启动活动名称应该像“packageName.MainActivty”而不是“.MainActivity”参见以下代码供您参考
<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>