我有一个 Android 库项目,我想在另一个 Android 项目中使用它。
该库在其 AndroidManifest 中声明了一个 Activity。当我在第二个项目中尝试以下操作时:
Intent intent = new Intent(this, ReaderActivity.class);
startActivity(intent);
我得到以下异常:
java.lang.RuntimeException: Unable to start activity ComponentInfo{br.com.digitalpages.reader.demo/br.com.digitalpages.reader.demo.ReaderDemoActivity}: android.content.ActivityNotFoundException: Unable to find explicit activity class {br.com.digitalpages.reader.demo/br.com.digitalpages.reader.ReaderActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
...
Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {br.com.digitalpages.reader.demo/br.com.digitalpages.reader.ReaderActivity}; have you declared this activity in your AndroidManifest.xml?
at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1404)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1378)
...
如何从另一个项目中打开活动?
编辑:通过用户的回答,我在我的第二个项目中添加了以下行
<uses-library android:name="br.com.digitalpages.reader" android:required="true" />
但它仍然不起作用