And*_*Eve 10 eclipse android eclipse-plugin
我的目标是复制NotePad示例项目,这样如果我修改源文件以便通过实验学习,原始示例文件将不会受到影响.这个目标背后的理性在@Neutrino的这篇文章的子弹1-2-3中得到了很好的解释.
根据@ Neutrino的帖子,我执行了以下步骤:
步骤1:将示例代码复制到临时位置(工作区目录之外):
1. Close Eclipse.
2. Copy the entire sample folder
**NotePad** from C:\android-sdk-windows\samples\android-7
to C:\Users\androideve\Documents\NotePad
Run Code Online (Sandbox Code Playgroud)
步骤2.从副本导入到工作区:
1. Start Eclipse
2. File > New > Project > Android Project [Next]
> Create project from existing **source**: C:\Users\androideve\Documents\NotePad
3. Delete project from Package Explorer (without deleting its files from disk!)
4. File > Import...
> General > Existing Projects into Workspace [Next]
> Browse: C:\Users\androideve\Documents\NotePad
> Check "Copy projects into workspace" [Finish]
5. Delete entire folder C:\Users\androideve\Documents\NotePad from disk.
Run Code Online (Sandbox Code Playgroud)
这导致项目创建,但它带有21个错误,没有任何线索导致它们的原因(记住,我是一个Android新手,我没有编写NotePad程序):
Description Resource Path Location Type
Error generating final archive: java.io.FileNotFoundException: C:\sb\workspace\NotesList\bin\resources.ap_ does not exist NotesList Unknown Android Packaging Problem
error: Error: String types not allowed (at 'layout_height' with value 'match_parent'). note_editor.xml /NotesList/res/layout line 17 Android AAPT Problem
error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). note_editor.xml /NotesList/res/layout line 17 Android AAPT Problem
error: Error: String types not allowed (at 'layout_width' with value 'match_parent'). noteslist_item.xml /NotesList/res/layout line 17 Android AAPT Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 148 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 151 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 175 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 177 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 194 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 195 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 265 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 269 Java Problem
R cannot be resolved to a variable NoteEditor.java /NotesList/src/com/example/android/notepad line 276 Java Problem
R cannot be resolved to a variable NotesList.java /NotesList/src/com/example/android/notepad line 83 Java Problem
R cannot be resolved to a variable NotesList.java /NotesList/src/com/example/android/notepad line 94 Java Problem
R cannot be resolved to a variable NotesList.java /NotesList/src/com/example/android/notepad line 177 Java Problem
R cannot be resolved to a variable NotesLiveFolder.java /NotesList/src/com/example/android/notepad line 48 Java Problem
R cannot be resolved to a variable NotesLiveFolder.java /NotesList/src/com/example/android/notepad line 51 Java Problem
R cannot be resolved to a variable TitleEditor.java /NotesList/src/com/example/android/notepad line 71 Java Problem
R cannot be resolved to a variable TitleEditor.java /NotesList/src/com/example/android/notepad line 80 Java Problem
R cannot be resolved to a variable TitleEditor.java /NotesList/src/com/example/android/notepad line 83 Java Problem
Run Code Online (Sandbox Code Playgroud)
我做错了什么,我需要做什么来制作和运行这个NotePad示例的副本?
And*_*Eve 11
好吧,我想我到了那里(注意原始步骤和以下步骤之间的细微差别):
步骤1:将示例代码复制到临时位置(工作区目录之外):
1. Close Eclipse.
2. Copy the entire sample folder
**NotePad** from C:\android-sdk-windows\samples\android-8
to C:\Users\androideve\Documents\NotePad
Run Code Online (Sandbox Code Playgroud)
步骤2.从副本导入到工作区:
1. Start Eclipse
2. File > New > Project > Android Project [Next]
> Create project from existing **source**: C:\Users\androideve\Documents\NotePad
> Build Target: **Uncheck** Android 1.5. **Check** Android 2.2. [Finish]
3. Delete project from Package Explorer (without deleting its files from disk!)
4. File > Import...
> General > Existing Projects into Workspace [Next]
> Browse: C:\Users\androideve\Documents\NotePad
> Check "Copy projects into workspace" [Finish]
5. Delete entire folder C:\Users\androideve\Documents\NotePad from disk.
Run Code Online (Sandbox Code Playgroud)
现在,项目像以前一样创建,但是我只有1个警告,而不是21个错误:
Description Resource Path Location Type
Attribute minSdkVersion (3) is lower than the project target API level (8) AndroidManifest.xml /NotesList line 1 Android ADT Problem
Run Code Online (Sandbox Code Playgroud)
我在控制台上也有两条红色消息:
[2011-02-10 12:45:50 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read C:\android-sdk-windows\AndroidManifest.xml: java.io.FileNotFoundException: C:\android-sdk-windows\AndroidManifest.xml (The system cannot find the file specified)
[2011-02-10 12:45:50 - com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper] Unable to read C:\android-sdk-windows\AndroidManifest.xml: java.io.FileNotFoundException: C:\android-sdk-windows\AndroidManifest.xml (The system cannot find the file specified)
Run Code Online (Sandbox Code Playgroud)
的确如此:C:\ android-sdk-windows中没有AndroidManifest.xml,但NoteList目录中有一个.为什么抱怨这个?为什么它在C:\ android-sdk-windows中查找?
无论如何,在创建启动配置之后,复制的逐字样本项目继续在模拟器上运行而没有任何问题(现在我终于可以继续学习它的编程方面).
总之,问题的根源是我使用的是Android 7样本(而不是Android 8),并且我继续使用构建目标1.5(而不是2.2).
一切都很好.:)
| 归档时间: |
|
| 查看次数: |
14653 次 |
| 最近记录: |