Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/svn/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在android中将库文件移动到主项目_Android_Android Layout_Android Manifest_Android Library - Fatal编程技术网

在android中将库文件移动到主项目

在android中将库文件移动到主项目,android,android-layout,android-manifest,android-library,Android,Android Layout,Android Manifest,Android Library,我正在使用开源OI ShoppingList模板,并试图从中修改它 有两个库和一个主项目,我正试图将库移动到主项目“oishoppinglist”,但它给了我错误的代码 我成功地移动了其中一个“ShoppingListLibrary”。我在移动DistributionLibrary时没有遇到任何问题,但当我将布局文件(“oi_distribution_eula”、“oi_distribution_infoactivity”)移动到主项目3源文件时,这些文件就坏了 任何想法我应该改变,使这项工作一

我正在使用开源OI ShoppingList模板,并试图从中修改它

有两个库和一个主项目,我正试图将库移动到主项目“oishoppinglist”,但它给了我错误的代码

我成功地移动了其中一个“ShoppingListLibrary”。我在移动DistributionLibrary时没有遇到任何问题,但当我将布局文件(“oi_distribution_eula”、“oi_distribution_infoactivity”)移动到主项目3源文件时,这些文件就坏了

任何想法我应该改变,使这项工作一直在到处寻找,但没有运气

这里是到源代码的dropbox链接。

提前谢谢

编辑1:谢谢你的反馈。下面是setContentView(R.layout.oi_distribution_infoactivity)中出现错误的代码之一

在布局下,错误显示为“布局无法解析或不是字段”

我已经尝试导入R类,清理项目,但仍然有那个错误

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mDistribution.setFirst(MENU_DISTRIBUTION_START, DIALOG_DISTRIBUTION_START);

    // Check whether EULA has been accepted
    // or information about new version can be presented.
    if (mDistribution.showEulaOrNewVersion()) {
        return;
    }

    setContentView(R.layout.oi_distribution_infoactivity);

    init();

    mApplicationStrings = new String[mApplications.length];
    for (int i = 0; i < mApplications.length; i++) {
        mApplicationStrings[i] = getString(mApplications[i]);
    }
    setListAdapter(new FontArrayAdapter<String>(this,
            android.R.layout.simple_list_item_1, mApplicationStrings));
    ListView listview = getListView();

    listview.setOnItemClickListener(this);

    // Set message of activity
    String appname = VersionUtils.getApplicationName(this);
    String message = getString(R.string.oi_distribution_info_activity_text, 
            appname);
    TextView tv = (TextView) findViewById(R.id.text);
    tv.setText(message);

    /*
    TypedArray a = obtainStyledAttributes(mTheme, R.styleable.ShoppingList);
    String typefaceName = a.getString(R.styleable.ShoppingList_textTypeface);
    mTextSizeMedium = a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeMedium, 23);
    mTextSizeLarge = a.getDimensionPixelOffset(R.styleable.ShoppingList_textSizeLarge, 28);
    mTextColor = a.getColor(R.styleable.ShoppingList_textColor, Color.BLACK);
    Drawable background = a.getDrawable(R.styleable.ShoppingList_background);


    View v = findViewById(R.id.background);
    v.setBackgroundDrawable(background);

    mTypeface = Typeface.createFromAsset(getResources().getAssets(), typefaceName);

    TextView tv = (TextView) findViewById(R.id.text);
    tv.setTypeface(mTypeface);
    tv.setTextSize(mTextSizeMedium);
    tv.setTextColor(mTextColor);
    */
}
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
mDistribution.setFirst(菜单分配开始,对话框分配开始);
//检查EULA是否已被接受
//也可以提供有关新版本的信息。
如果(mDistribution.showEulaOrNewVersion()){
返回;
}
setContentView(R.layout.oi_distribution_infoactivity);
init();
mApplicationStrings=新字符串[mApplications.length];
对于(int i=0;i
您不应该期望这里的用户下载并试图编译您的代码。发布简短且相关的代码片段以及您收到的任何错误。感谢您的反馈,我编辑了这个问题。我猜您的资源中有一个错误(可能在布局中,可能是可绘制的或字符串),导致
R
无法正确生成。检查你的资源,确保没有错误。我试了很多次,但一切都开始崩溃,所以我保持原样。感谢您的帮助为什么要这样将此库移动到项目中?为了获得最佳实践,请将每个库作为项目的一个元素导入(在项目属性中),如果要修改或添加内容,请直接在库中执行此操作