Android 项目没有设定目标。编辑项目属性以设置一个

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2292416/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 05:17:50  来源:igfitidea点击:

Project has no target set. Edit the project properties to set one

androideclipse

提问by jadkins4

When I import a new existing project into Eclipse, I get the following error message when attempting to execute as an Android project:

当我将新的现有项目导入 Eclipse 时,尝试作为 Android 项目执行时收到以下错误消息:

Project has no target set. Edit the project properties to set one

项目没有设定目标。编辑项目属性以设置一个

Any help is appreciated.

任何帮助表示赞赏。

采纳答案by Olof

Using eclipse Juno, and there is no such menu as Project ? Properties ? Java Build Path anywhere.

使用 eclipse Juno,并且没有 Project 之类的菜单?特性 ?任何地方的 Java 构建路径。

Closest menu entry is Window->preferences->android but in that menu it is not possible to remove any entries.

最近的菜单条目是 Window->preferences->android 但在该菜单中无法删除任何条目。

My solution now is to create another project with files having the exact same name as the original project and then manually copy and paste the code.

我现在的解决方案是使用与原始项目同名的文件创建另一个项目,然后手动复制并粘贴代码。

回答by IgorGanapolsky

I got this error on the command line when I ran ./android update project -p .Basically I had to specify a target like so in order for it to work: ./android update project -p . --target android-10

当我运行时,我在命令行上收到此错误./android update project -p .基本上我必须指定这样的目标才能使其工作: ./android update project -p . --target android-10

回答by VonC

From the comments of this article:

来自这篇文章的评论:

[2009-05-27 12:18:36 - DroidGap] Project has no target set. Edit the project properties to set one.
[2009-05-27 12:18:38 - DroidGap] no classfiles specified
[2009-05-27 12:18:38 - DroidGap] Conversion to Dalvik format failed with error 1

I was able to solve this on the Projects > Properties > Androidscreen by:

  • first selecting Google APIs (which was incorrect for my setup)
  • and then reselecting Android 1.5 (which is correct and had previously been selected).

I was immediately able to run the emulator following this change.

我能够通过以下方式在Projects > Properties > Android屏幕上解决此问题:

  • 首先选择 Google API(这对我的设置不正确)
  • 然后重新选择Android 1.5(这是正确的,之前已经选择了)。

在此更改后,我立即能够运行模拟器。

回答by Tiago

My problem was that the target specified inside the project.propertiesfile was not installed. It was "target=android-3", which is the Cupcake target.

我的问题是没有安装project.properties文件中指定的目标。它是“target=android-3”,这是纸杯蛋糕的目标。

I solved it by increasing the number to 8 (Froyo API) which is the oldest API level I had installed in my environment.

我通过将数字增加到 8(Froyo API)来解决它,这是我在我的环境中安装的最旧的 API 级别。

回答by KrishnaNittala

I got this error when I copied the project folder 'google-play-services_lib' alone after separating it from its actual folder structure into my workspace and referenced it in my project. But I could resolve the error by referencing the project folder 'google-play-services_lib' with out separating it from its actual folder structure. Actual folder structure: google_play_services > libproject > google-play-services_lib.

当我将项目文件夹 'google-play-services_lib' 从其实际文件夹结构分离到我的工作区并在我的项目中引用它后,单独复制项目文件夹时出现此错误。但是我可以通过引用项目文件夹“google-play-services_lib”而不将其与其实际文件夹结构分开来解决错误。实际文件夹结构:google_play_services > libproject > google-play-services_lib。

Hope this helps!!!!!-)

希望这可以帮助!!!!!-)

回答by eqianyu1204

This is because you firstly put the project files in the resourse path. Try to put the project in another file, and reimport it. It will work!!!

这是因为您首先将项目文件放在资源路径中。尝试将项目放在另一个文件中,然后重新导入。它会起作用!!!

回答by shiv

I just resolved my issue by setting the higher target. go to windows->preference->android and check on higher API available and click apply.

我只是通过设置更高的目标来解决我的问题。转到 windows->preference->android 并检查可用的更高 API,然后单击应用。

might work for you also.

也可能对你有用。

回答by gaurav

Go to Project ? Properties ? Java Build Path ? Libraries and remove all except the "Android X.Y" (in my case Android 1.5). click OK. Go to Project ? Clean ? Clean projects selected below ? select your project and click OK. That should work.

去项目?特性 ?Java构建路径?库并删除除“Android XY”之外的所有库(在我的情况下为 Android 1.5)。单击确定。去项目?干净的 ?下面选择的清洁项目?选择您的项目,然后单击“确定”。那应该工作。

It is also possible that you have a JAR file located somewhere in your project folders (I had copied the Admob JAR file into my src folder) and THEN added it as a Java Path Library. It does not show up under the Package Explorer, so you don't notice it, but it does get counted twice, causing the dreaded Dalvik error 1.

也有可能您的项目文件夹中的某个位置有一个 JAR 文件(我已将 Admob JAR 文件复制到我的 src 文件夹中),然后将其添加为 Java 路径库。它没有出现在包资源管理器下,所以你不会注意到它,但它确实被计数了两次,导致可怕的 Dalvik 错误 1。