1、APP的工程结构

App项目下面有两个分类:app(代表app模块)、Gradle Scripts。

 

app下面又有3个子目录,功能说明如下:

manifests子目录,存放AndroidManifest.xml,它是App的运行配置文件。

java子目录,存放当前模块的Java源代码。

res子目录,存放当前模块的资源文件。

 

Gradle Scripts下面主要是工程的编译配置文件:

build.gradle,该文件分为项目级与模块级两种,用于描述App工程的编译规则。

plugins { id 'com.android.application' } android { compileSdk 32//编译用的SDK版本号
defaultConfig { applicationId "com.example.helloworld"//模块应用编码,APP包名 minSdk
28//目标sdk的版本号 targetSdk 32//指定app适合运行的最小版本号 versionCode 1//指定APP的应用版本名称
versionName "1.0" testInstrumentationRunner
"androidx.test.runner.AndroidJUnitRunner" } buildTypes { release {
minifyEnabled false proguardFiles
getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' }
} compileOptions { sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 } } //指定APP的编译依赖信息 dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'//指定引用JAR包路径 implementation
'com.google.android.material:material:1.4.0' implementation
'androidx.constraintlayout:constraintlayout:2.0.4'//指定编译Android的高版本支持库
testImplementation 'junit:junit:4.13.2'//指定单元编译的junit版本号
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' }
 

proguard-rules.pro,该文件描述了Java代码的混淆规则。(隐藏文件,可运行,提升安卓的安全性)

gradle.properties,该文件配置了编译工程的命令行参数,一般无须改动。

settings.gradle,该文件配置了需要编译哪些模块。

local.properties,它是项目的本地配置文件。

Gradle:项目自动化构建工具,帮助我们做了依赖、打包、部署、发布、各种渠道的差异化的管理工作(APK的打包)

 

运行配置文件AndroidManifest.xml

AndroidManifest.xml指定了App的运行配置信息,它的根节点为manifest,package属性指定了该App的包名。
manifest下面有个application节点,它的各属性说明如下:

android:allowBackup,是否允许应用备份。为true表示允许,为false表示不允许。

android:icon,指定App在手机屏幕上显示的图标。

android:label,指定App在手机屏幕上显示的名称。

android:supportsRtl,是否支持从右往左的文字排列顺序。

android:theme,指定App的显示风格。 

 

 

 2、APP设计规范

XML标记描绘应用界面

Java书写程序逻辑

 

技术
下载桌面版
GitHub
百度网盘(提取码:draw)
Gitee
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:ixiaoyang8@qq.com
QQ群:766591547
关注微信