简单认识APP项目
manifests:里面只有一个xml,是app运行配置文件 清单文件
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application
//是否允许备份
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
//指定图标
android:icon="@mipmap/ic_launcher"
//指定名称
android:label="@string/app_name"
//圆角图标
android:roundIcon="@mipmap/ic_launcher_round"
//是否支持从右向左的文字排列顺序
android:supportsRtl="true"
//主要主题风格
android:theme="@style/Theme.MyApplication"
tools:targetApi="31">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data
android:name="android.app.lib_name"
android:value="" />
</activity>
</application>
</manifest>

java:三个包 第一个包存放当前模块源代码,后面两个包存放测试用java代码
res:存放资源(还有一个xml没提)


全局配置(全局生效)与模块配置(仅当前app声效)


plugins {
id 'com.android.application'
}
android {
namespace 'com.example.myapplication'
//指定编译的用的SDK版本号 30表示android11.0
compileSdk 32
defaultConfig {
//此处为应用的包名/模块名 **注意与清单文件内的包名一致
applicationId "com.example.myapplication"
//最小可运行的版本号
minSdk 21
//表示出你最希望的运行版本号
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.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

浙公网安备 33010602011771号