【问题标题】:I want to open acra project in eclipse我想在eclipse中打开acra项目
【发布时间】:2013-02-12 18:23:20
【问题描述】:

我尝试将 acra http://code.google.com/p/acra/source/checkout 导入 Eclipse,但 Eclipse 假定它是标准 Java 项目,所以 Eclipse 显示导入错误

import android.app.Application;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceManager;
import android.util.Log;   

我的意思是任何与 Android 相关的导入都会导致错误,在 IDE 中打开 acra 源代码的理想方法是什么?

【问题讨论】:

标签: android eclipse acra


【解决方案1】:

Eclipse 中的 Java 项目和 Android 项目是有区别的。该项目应该是一个 Android 项目,以便正确解析 Android 导入。 首先确保你有:

  1. Android SDK 已安装在您的计算机上。
  2. Android plugin 安装在 Eclipse 中。

然后在 Eclipse 中转到菜单File > Import,选择Android,然后选择Existing Android code into workspace

或者,您可以尝试肮脏的方式并将现有的 .project 文件更改为类似的内容

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ACRA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>org.eclipse.jdt.core.javabuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
    <buildCommand>
        <name>com.android.ide.eclipse.adt.ApkBuilder</name>
        <arguments>
        </arguments>
    </buildCommand>
</buildSpec>
<natures>
    <nature>com.android.ide.eclipse.adt.AndroidNature</nature>
    <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

【讨论】:

  • 我在eclipse中将ACRA项目标记为库项目。但它的类仍然没有导入到我的另一个项目中。
猜你喜欢
  • 1970-01-01
  • 2014-03-18
  • 1970-01-01
  • 2015-05-01
  • 2014-05-09
  • 1970-01-01
  • 2013-07-20
  • 2021-02-14
  • 2015-01-05
相关资源
最近更新 更多