0

我有一个使用OI FileManager的测试项目。我将该项目作为 Android 库添加到我的测试项目中,然后在库中调用 Activity。它显示错误:

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>

表明:

E/AndroidRuntime( 1393): FATAL EXCEPTION: main
E/AndroidRuntime( 1393): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.androidcoretest/org.openintents.filemanager.FileManagerActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidcoretest/org.openintents.distribution.EulaActivity}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime( 1393):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
E/AndroidRuntime( 1393):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
E/AndroidRuntime( 1393):    at android.app.ActivityThread.access$2300(ActivityThread.java:125)
E/AndroidRuntime( 1393):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
E/AndroidRuntime( 1393):    at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 1393):    at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 1393):    at android.app.ActivityThread.main(ActivityThread.java:4627)
E/AndroidRuntime( 1393):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 1393):    at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 1393):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
E/AndroidRuntime( 1393):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
E/AndroidRuntime( 1393):    at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 1393): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.androidcoretest/org.openintents.distribution.EulaActivity}; have you declared this activity in your AndroidManifest.xml?
E/AndroidRuntime( 1393):    at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
E/AndroidRuntime( 1393):    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
E/AndroidRuntime( 1393):    at android.app.Activity.startActivityForResult(Activity.java:2817)
E/AndroidRuntime( 1393):    at android.app.Activity.startActivity(Activity.java:2923)
E/AndroidRuntime( 1393):    at org.openintents.distribution.EulaOrNewVersion.startForwardActivity(EulaOrNewVersion.java:127)
E/AndroidRuntime( 1393):    at org.openintents.distribution.EulaOrNewVersion.showEula(EulaOrNewVersion.java:69)
E/AndroidRuntime( 1393):    at org.openintents.distribution.DistributionLibrary.showEulaOrNewVersion(DistributionLibrary.java:53)
E/AndroidRuntime( 1393):    at org.openintents.filemanager.FileManagerActivity.onCreate(FileManagerActivity.java:312)
E/AndroidRuntime( 1393):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
E/AndroidRuntime( 1393):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
E/AndroidRuntime( 1393):    ... 11 more
W/ActivityManager(   59):   Force finishing activity com.androidcoretest/org.openintents.filemanager.FileManagerActivity

我会说这是 Eclipse 的一个错误。Eclipse 和 ADT 最近在构建过程中有很多错误:ClassNotFound 和 ActivityNotFound。

更新:我的代码只使用一行:

            final Intent intent = new Intent(FileExplorerTest.this, FileManagerActivity.class);
            startActivity(intent);

其实我有3个项目。2个图书馆项目和1个测试项目。库“OI File Manager”使用库“OI Distribution”,然后测试项目C使用库“IO File Manager”。

4

2 回答 2

1

确保将 OI FileManager 项目链接为库而不是外部 jar。转到项目属性 > Android > 库,然后单击添加库。

然后,当您在项目清单中定义活动时(但是使用 ADT 20,我认为这是自动的)

<activity
        android:label="@string/app_name"
        android:name="org.openintents.filemanager.FileManagerActivity" >    
    </activity>
于 2012-07-25T08:04:29.627 回答
0

com.androidcoretest/org.openintents.distribution.EulaActivity我猜它找不到FileManager活动。你EulaActivity在清单中有那个吗?

在您的日志中查看:

引起:android.content.ActivityNotFoundException:无法找到明确的活动类{com.androidcoretest/org.openintents.distribution.EulaActivity};您是否在 AndroidManifest.xml 中声明了此活动?

于 2012-07-25T08:03:48.310 回答