Andure 项目启动与配置教程

Andure 项目启动与配置教程

andure DevTools for Android Chrome — works on any website, on any Chromium browser. andure 项目地址: https://gitcode.com/gh_mirrors/an/andure

1. 项目目录结构及介绍

Andure 项目目录结构如下所示:

andure/
├── app/                # 应用程序目录
│   ├── main/           # 主程序目录
│   │   ├── java/       # Java 源代码目录
│   │   ├── res/        # 资源目录,包含布局文件、图片等
│   │   ├── AndroidManifest.xml # Android 清单文件
│   │   └── build.gradle # 模块构建文件
│   └── build.gradle    # 应用程序构建文件
├── gradle/             # Gradle 脚本目录
├── build.gradle        # 项目构建文件
├── settings.gradle     # 项目设置文件
└── README.md           # 项目说明文档

目录详细介绍:

  • app/: 应用程序的主要目录,包含了所有与应用程序相关的文件。
  • app/main/: 主程序目录,包含了 Java 源代码、资源文件和 Android 清单文件。
  • app/main/java/: 存放 Java 源代码的目录。
  • app/main/res/: 资源目录,包含了布局文件(layout)、图片(drawable)、字符串资源(strings)等。
  • app/main/AndroidManifest.xml: Android 清单文件,描述了应用程序的名称、权限、入口点等信息。
  • app/build.gradle: 应用程序模块的构建文件,定义了如何编译和打包应用程序。
  • gradle/: Gradle 脚本目录,存放了一些 Gradle 相关的脚本文件。
  • build.gradle: 项目构建文件,定义了整个项目的构建逻辑。
  • settings.gradle: 项目设置文件,用于配置 Gradle 的项目级设置。
  • README.md: 项目说明文档,介绍了项目的相关信息和如何使用。

2. 项目的启动文件介绍

项目的启动文件主要是 Android 清单文件 AndroidManifest.xml,它位于 app/main/ 目录下。以下是 AndroidManifest.xml 文件的基本内容:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.andure">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

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

</manifest>

这个文件定义了应用程序的基本信息和启动活动(MainActivity)。<activity> 标签中的 <intent-filter> 指定了该活动是应用程序的启动点。

3. 项目的配置文件介绍

项目的配置文件主要是 build.gradle 文件,它位于项目根目录和 app 目录下。

项目级 build.gradle 文件:

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        jcenter()
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.0"
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        google()
        jcenter()
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

这个文件定义了项目级别的构建脚本,包括所有的依赖项和仓库。

应用程序级 build.gradle 文件:

plugins {
    id 'com.android.application'
}

android {
    compileSdkVersion 30
    buildToolsVersion "30.0.2"

    defaultConfig {
        applicationId "com.example.andure"
        minSdkVersion 21
        targetSdkVersion 30
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'androidx.appcompat:appcompat:1.2.0'
    implementation 'com.google.android.material:material:1.3.0'
    implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
    testImplementation 'junit:junit:4.13.1'
    androidTestImplementation 'androidx.test.ext:junit:1.1.2'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
}

这个文件定义了应用程序的构建配置,包括编译 SDK 版本、最低 SDK 版本、目标 SDK 版本、应用程序 ID、版本号等,以及应用程序的依赖项。

andure DevTools for Android Chrome — works on any website, on any Chromium browser. andure 项目地址: https://gitcode.com/gh_mirrors/an/andure

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

丁战崇Exalted

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值