安卓:包括多个Java软件包的体现 [英] Android: Including multiple Java Packages to Manifest

查看:154
本文介绍了安卓:包括多个Java软件包的体现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

该应用程序我开发具有分为七个Java包了许多活动。本来我在一个Java包为不同的项目写的所有的编码和东西各组的活动。

The app I am developing has many activities organized into seven java packages. Originally I wrote all the coding and stuff for each group of activities in a java package as different projects.

现在我在我想要把所有的包连成一个项目点。当我添加一个新的包到src文件夹中,我得到了我所有的R.id. *值(R不能解析)中的错误。

Now I'm at the point where I want to put all the packages together into one project. When I add a new package to the src folder, I get an error for all my R.id.* values ("R cannot be resolved").

我的直觉告诉我,有一些花哨的我已经把在项目清单中,但我不能在网上找到的任何资源来告诉我怎么了。

My instinct tells me that there is something fancy I have to put in the project manifest, but I can't find any resource online to tell me how.

(注:我已阅读和的this ,我仍然无法弄清楚如何添加额外的软件包来我的项目。)

(Note: I have read this and this and I still couldn't figure out how to add additional packages to my project.)

推荐答案

请确保在活动顶部的import语句引用了正确的R档。每个项目都有自己的研发文件,因此,如果您从一个项目复制一个活动到另一个仍然会试图从旧项目引用R档。

Make sure that the import statement at the top of the Activity references the correct R file. Each project has its own R file, so if you copy an Activity from one project to another it will still be trying to reference the R file from the old project.

您不需要任何明确纳入不同的软件包的清单。包括来自两个不同的套餐活动,说:

You do not need any explicit inclusion of different packages in the manifest. To include activities from two different packages, say:

com.example.package1.Activity1
com.example.package2.Activity2

您可以执行以下操作:

<manifest package="com.example" . . . >
  <application . . .>
    <activity android:name=".package1.Activity1" . . . />
    <activity android:name=".package2.Activity2" . . . />
  </application>
</manifest>

这篇关于安卓:包括多个Java软件包的体现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆