gpt4 book ai didi

android - 我想在 eclipse 中打开 acra 项目

转载 作者:太空宇宙 更新时间:2023-11-03 10:50:02 25 4
gpt4 key购买 nike

我尝试导入 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 源代码的理想方法是什么?

最佳答案

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>

关于android - 我想在 eclipse 中打开 acra 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14839174/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com