• 1、Android APP开发基础


    1、APP的工程结构

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

     

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

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

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

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

     

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

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

    1. plugins {
    2. id 'com.android.application'
    3. }
    4. android {
    5. compileSdk 32//编译用的SDK版本号
    6. defaultConfig {
    7. applicationId "com.example.helloworld"//模块应用编码,APP包名
    8. minSdk 28//目标sdk的版本号
    9. targetSdk 32//指定app适合运行的最小版本号
    10. versionCode 1//指定APP的应用版本名称
    11. versionName "1.0"
    12. testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    13. }
    14. buildTypes {
    15. release {
    16. minifyEnabled false
    17. proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
    18. }
    19. }
    20. compileOptions {
    21. sourceCompatibility JavaVersion.VERSION_1_8
    22. targetCompatibility JavaVersion.VERSION_1_8
    23. }
    24. }
    25. //指定APP的编译依赖信息
    26. dependencies {
    27. implementation 'androidx.appcompat:appcompat:1.3.0'//指定引用JAR包路径
    28. implementation 'com.google.android.material:material:1.4.0'
    29. implementation 'androidx.constraintlayout:constraintlayout:2.0.4'//指定编译Android的高版本支持库
    30. testImplementation 'junit:junit:4.13.2'//指定单元编译的junit版本号
    31. androidTestImplementation 'androidx.test.ext:junit:1.1.3'
    32. androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
    33. }

     

    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书写程序逻辑

     

  • 相关阅读:
    兄弟携手!魅族与星纪时代共同发力出行领域,沈子瑜成舵手
    信息安全相关知知识点
    python占位符
    Scratch软件编程等级考试二级——20210911
    Vue3.0 中的响应式对象
    为什么要进行数据治理
    nvidia显卡驱动安装失败怎么办?
    springboot读取resources下文件方式
    【深度学习】树莓派Zero w深度学习模型Python推理
    Text to image论文精读PDF-GAN:文本生成图像新度量指标SSD Semantic Similarity Distance
  • 原文地址:https://blog.csdn.net/weixin_62190821/article/details/126677696