简体   繁体   English

第一个android项目构建错误

[英]First android project build error

im just experimenting with Android + Java. 我只是尝试使用Android + Java。

Im following this guide: http://developer.android.com/training/basics/firstapp/index.html 我正在遵循此指南: http : //developer.android.com/training/basics/firstapp/index.html

Did everything just as it is. 一切照原样进行。 I've only changed "DisplayMessageActivity" class name to " DisplayMsgActivity" I've updated the manifest, and all references to this class, but Im still getting 2 errors: 我只将“ DisplayMessageActivity”类名称更改为“ DisplayMsgActivity”,我更新了清单以及所有对该类的引用,但我仍然遇到2个错误:

-compile:
[javac] Compiling 4 source files to /home/juanchi/Dropbox/Dev/ArrayAppProject/bin/classes
[javac] /home/juanchi/Dropbox/Dev/ArrayAppProject/src/com/jnix/arrayapp/DisplayMsgActivity.java:7: duplicate class: DisplayMsgActivity
[javac] public class DisplayMsgActivity extends Activity {
[javac]        ^
[javac] /home/juanchi/Dropbox/Dev/ArrayAppProject/src/com/jnix/arrayapp/ArrayAppActivity.java:20: cannot access com.jnix.arrayapp.DisplayMsgActivity
[javac] bad class file: RegularFileObject[/home/juanchi/Dropbox/Dev/ArrayAppProject/src/com/jnix/arrayapp/DisplayMsgActivity.java]
[javac] file does not contain class com.jnix.arrayapp.DisplayMsgActivity
[javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
[javac]         Intent intent = new Intent(this, DisplayMsgActivity.class);
[javac]                                          ^
[javac] 2 errors

BUILD FAILED /home/juanchi/android-sdks/tools/ant/build.xml:680: The following error occurred while executing this line: /home/juanchi/android-sdks/tools/ant/build.xml:693: Compile failed; 失败/home/juanchi/android-sdks/tools/ant/build.xml:680:执行此行时发生以下错误:/home/juanchi/android-sdks/tools/ant/build.xml:693:编译失败 see the compiler error output for details. 有关详细信息,请参见编译器错误输出。

Total time: 5 seconds 总时间:5秒

Any ideas? 有任何想法吗?

try to declare: 尝试声明:

package com.jnix.arrayapp

on the top of the file DisplayMsgActivity 在文件顶部的DisplayMsgActivity

Clean and build the project. 清理并构建项目。 sometimes it works. 有时可以。

Everyone uses eclipse for learning and development. 每个人都使用蚀来学习和发展。 Just create projects in eclipse. 只需在Eclipse中创建项目即可。 You can import the source into your eclipse project and go from there. 您可以将源导入到eclipse项目中,然后从那里进行。 I would start with basic project inside eclipse not outside. 我将从eclipse而不是外部的基本项目开始。 Its way more frustrating to work outside eclipse. 在日食以外工作的方式更加令人沮丧。 There are many other reasons to use eclipse, like good view of logcat, debugging etc. 使用eclipse的其他原因很多,例如对logcat的了解,调试等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM