我在我的项目中使用了一些库和一个项目(GrazeRSS - https://github.com/travistabbal/GrazeRSS)
我已将 GrazeRSS 添加到“项目”选项卡中的“Java 构建路径”项目中。
我在从我的项目启动其中一项 Activity 时遇到问题..
首先 - 我将其他项目 Activity 添加到我的项目 list 文件中:
<activity
android:name="com.grazerss.feedly.FeedlyLoginActivity"
android:label="@string/app_name"
android:theme="@style/Theme.Sherlock" />
其次 - 我尝试使用以下方法从我的项目开始 Activity :
Intent i = new Intent();
i.setComponent(new ComponentName("com.grazerss.feedly.newton", "com.grazerss.feedly.FeedlyLoginActivity"));
startActivity(i);
我也试过:
Intent i = new Intent(ServiceProviderActivity.this,
com.grazerss.feedly.FeedlyLoginActivity.class);
startActivity(i);
ServiceProviderActivity 是我的项目类之一
运行应用程序时我得到:
03-13 02:41:36.644: E/dalvikvm(26634): Could not find class 'com.grazerss.feedly.FeedlyLoginActivity', referenced from method com.xd.triple.activities.ServiceProviderActivity$1.onClick
当点击启动“FeedlyLoginActivity”的按钮时,我得到:
03-13 02:41:25.554: E/AndroidRuntime(25984): java.lang.NoClassDefFoundError: com.grazerss.feedly.FeedlyLoginActivity
有人知道这里发生了什么吗?
我已经尝试了 4 个小时来解决这个问题..
提前致谢
喧嚣。
最佳答案
Second - I tried to start the activity from my project using:
这是不正确的,除非您的应用程序的包名在<manifest>
中是com.grazerss.feedly.newton
.
I also tried
这应该会更好,因为它将使用您的应用程序自己的包名称。
Does anyone have idea whats going on here?
你的项目中没有这样的类。这很可能是因为:
I have added GrazeRSS to my project "Java Build Path" in the "Projects" tab..
...这是错误的。撤消它。
假设您正在尝试合并 app/
中的内容该存储库的目录,这是一个应用程序。没有将一个应用程序全部合并到另一个应用程序的标准方法,除非将其所有文件复制到res/
中。 , src/
, 和 libs/
进入您项目的 res/
, src/
, 和 libs/
目录。或者,您可以尝试将该项目转换为 an Android library project并以这种方式使用它。
关于java - 启动另一个不是库的项目的 Activity | Java/安卓,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22366915/