New Android Project In Eclipse with SDK 4.0

ADK 4.0后使用Eclipse新建工程后的工程文件。

 

.project

项目文件,项目的结构都在其中定义。

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
	<name>XAlbum</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>

1.工程名字<name></name>

2.工程注释描述<comment></comment>

3.运行时需要的额外的Eclipse插件<natures></natures>,以及其具体的加载方式<buildSpec></buildSpec>  

 

.classpath

定义工程项目在编译时使用的$CLASSPATH

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="src" path="gen"/>
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
	<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
	<classpathentry kind="output" path="bin/classes"/>
</classpath>

1.源文件(.java)的具体位置(kind="src")

2.工程运行的系统环境(kind="con")

3.项目的输出目录(kind="output")

 

AndroidManifest.xml

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.arcsoft.xalbum"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="15" />

    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/title_activity_main" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

描述项目的版本以及所使用的ADK信息,说明activity,service,provider的信息,已经定义应用的权限。

 

proguard-project.txt

# To enable ProGuard in your project, edit project.properties
# to define the proguard.config property as described in that file.
#
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in ${sdk.dir}/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the ProGuard
# include property in project.properties.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html

# Add any project specific keep options here:

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}

Android提供的防止应用apk被逆向工程的机制,通过对代码进行扰乱压缩实现,即防止破解。(只在Release启动)

具体参见http://developer.android.com/guide/developing/tools/proguard.html

 

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

 

另外,在4.0后的工程中增加了一个\libs\android-support-v4.jar文件,这个文件的作用是,当工程中使用了后面新版本的ADK中提供的类的时候,而需要在旧版本的系统上运行的时候,就可以派上用场。因为这个jar中包含了这些新类的定义和声明,所以就可以通过额外库的方式在旧版本系统被应用程序加载而使用。具体参见http://developer.android.com/tools/extras/support-library.html

posted @ 2012-08-16 11:02  芈希有  阅读(444)  评论(0编辑  收藏  举报