android --- 应用无工程文件eclipse打开
今天需要在eclipse上研究一下android系统下的 packages\apps 应用代码,想利用eclipse 开发工具打开,但发现都没有工程文件,因此就自已做工程文件,其实非常简单。
1、从一个现有创建好的eclipse工作区内找到这两个文件:
.classpath 及 .project
其内容如下:
.classpath 基本上不用修改
如果能打开说明配置文件正确
3、编译错误
此时如果编译可能会报类似下面的错误:
[2013-03-04 11:39:09 - Settings] Project has no project.properties file! Edit the project properties to set one.
[2013-03-04 11:40:50 - Settings] Unable to resolve target 'android-14'很明确,工程下面没有 project.properties 这个文件,新建一个,内容如下:
# This file is automatically generated by Android Tools.# Do not modify this file -- YOUR CHANGES WILL BE ERASED!## This file must be checked in Version Control Systems.## To customize properties used by the Ant build system edit# "ant.properties", and override values to adapt the script to your# project structure.## To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt# Project target.target=android-16最后这个target根据你的android选的版本有关,注意这个版本与AndroidManifest.xml中定义的一致:<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="16" />以上红字的部分保持一致即可,看编译的提示修改其对应的版本。
4、如何取修改过android版本的jar文件
比如目前android不支持以太网,但在编写应用时需要使用,一种方式是定义同名的空类,另外一种方式就是从android编译系统上拿jar包导入。
这里说采用第二种方式:
一般的路径: out\target\common\obj\JAVA_LIBRARIES\framework_intermediates\classes.jar
这个 classes.jar 就是系统的jar包,可以在eclipse导入系统库使用。
用法在: http://blog.csdn.net/andyhuabing/article/details/8620743
ok, 经过以上几个步骤基本上就可以在eclipse上使用了。