包含Android库时的ActivityNotFoundException
我有一个测试项目,它使用。我将该项目作为Android库添加到测试项目中,然后调用库中的Activity。它显示错误:包含Android库时的ActivityNotFoundException,android,eclipse,ubuntu-12.04,Android,Eclipse,Ubuntu 12.04,我有一个测试项目,它使用。我将该项目作为Android库添加到测试项目中,然后调用库中的Activity。它显示错误: E/AndroidRuntime( 1359): FATAL EXCEPTION: main E/AndroidRuntime( 1359): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidcoretest/org.openintents
E/AndroidRuntime( 1359): FATAL EXCEPTION: main
E/AndroidRuntime( 1359): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidcoretest/org.openintents.filemanager.FileManagerActivity}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime( 1359): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
E/AndroidRuntime( 1359): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
E/AndroidRuntime( 1359): at android.app.Activity.startActivityForResult(Activity.java:2817)
E/AndroidRuntime( 1359): at android.app.Activity.startActivity(Activity.java:2923)
E/AndroidRuntime( 1359): at com.androidcoretest.FileExplorerTest$1.onClick(FileExplorerTest.java:24)
E/AndroidRuntime( 1359): at android.view.View.performClick(View.java:2408)
E/AndroidRuntime( 1359): at android.view.View$PerformClick.run(View.java:8816)
E/AndroidRuntime( 1359): at android.os.Handler.handleCallback(Handler.java:587)
E/AndroidRuntime( 1359): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime( 1359): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1359): at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1359): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1359): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1359): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1359): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 1359): at dalvik.system.NativeStart.main(Native Method)
当我在清单中添加该活动的完整路径时,它会生成另一个错误
<activity
android:label="@string/app_name"
android:name="org.openintents.filemanager.FileManagerActivity" >
</activity>
我会说这是Eclipse的一个bug。Eclipse和ADT最近在构建过程中有许多错误:ClassNotFound和ActivityNotFound
更新:
我的代码只使用一行:
final Intent intent = new Intent(FileExplorerTest.this, FileManagerActivity.class);
startActivity(intent);
实际上我有3个项目。2个库项目和1个测试项目。库“OI文件管理器”使用库“OI分发”,然后测试项目C使用库“IO文件管理器”。我猜它找不到
com.androidcoretest/org.openintents.Distribution.EulaActivity
而不是文件管理器
活动。清单中是否有EulaActivity
请参阅您的日志:
原因:android.content.ActivityNotFoundException:无法找到
显式活动类
{com.androidcoretest/org.openintents.distribution.EulaActivity};有
您在AndroidManifest.xml中声明了此活动
确保将OI FileManager项目链接为库,而不是外部jar。转到项目属性>Android>库,然后单击添加库 然后,当您在项目清单中定义活动时(但是对于ADT 20,我认为这是自动的)
展示您如何开始活动。当项目被添加为android库时,您不需要在清单中放置活动标记。您是否尝试过android:name=“.filemanager.FileManagerActivity”或android:name=“.org.openintents.filemanager.FileManagerActivity”点(.)我尝试了一切。清理、排除、重新启动、包括、重新启动。没有什么变化。如果你有时间,我给你我的teamviewer。我对它很厌烦(final-Intent-Intent=new-Intent(FileExplorerTest.this,org.openintents.filemanager.filemanager.FileManagerActivity.class);
您也尝试过吗?当然,正确的方法是将其添加为Android库。我不使用jar文件。
final Intent intent = new Intent(FileExplorerTest.this, FileManagerActivity.class);
startActivity(intent);
<activity
android:label="@string/app_name"
android:name="org.openintents.filemanager.FileManagerActivity" >
</activity>