android manifest文件描述

发表于:,更新于:,By Sally
大纲
  1. 1. app/build.gradle 文件
  2. 2. build system overview
  3. 3. Managing Project Overview
  4. 4. asset/ 和 raw/ 文件夹的区别
  5. 5. 使用command 运行程序 : 运行在真机上
  6. 6. 运行程序 : 运行在模拟器上

app/build.gradle 文件

  • defaultConfig settings
1
2
3
4
compiledSdkVersion - is the platform version against which you will compile your app.
applicationId - is the fully qualified package name for your application that you specified during the new project workflow.
minSdkVersion - is the minimum SDK version you specified during the new project workflow.this is the earliest verion of the Android SDK that your app supports.
targetSdkVersion - indicates the highest version of Android with which you have tested your application.(as new versions of Android become available, you should test your app on the new version and update this value to match the latest API level and thereby take advantage of new platform features.)

build system overview

  • Android Asset Packaging Tool (aapt) 安卓资源打包工具 :生成了R.java文件,建立了resources文件与java code之间的关联

  • aidl tool convert : 将.aidl接口转换成java接口

  • R.java .aidl 文件被编译成 .class文件

  • dex toll convert : 将.class文件转换成dalvike byte code .dex文件

  • apkbuilder tool : 编译所有未编译的资源(such as images) .dex 打包到 .apk文件

  • .apk 文件必须使用debug key 或者 release key打包,才能安装在设备上

Apps are limited to a 65k method reference limit. if your app reaches this limit, the build process outputs the following error message:

1
unable to execute dex : method ID not in [0, 0xffff]:65536.

Managing Project Overview

  • Android Application Modules : 最后打包到apk文件

  • Test Modules : JUnit test

  • Library Modules

  • App Engine Modules

asset/ 和 raw/ 文件夹的区别

都是存放资源文件的,本质上是一样的。
asset/ 文件夹存入游戏数据啊等等
raw/ 文件夹存入mp3 ogg等文件, 这里的文件会在 R.java 中声明

使用command 运行程序 : 运行在真机上

  • on windows
1
gradlew.bat assembelDebug
  • on mac os and linux
1
2
chmod +x gradlew
./gradlew assembleDebug
  • install application : 确保 platform-tools/ 设置了 PATH, 目前存在~/.zshrc中
1
2
$ ant debug
adb install app/buile/outputs/apk/app-debug.apk

运行程序 : 运行在模拟器上

  • 创建模拟器
  1. 在android studio打开avd创建模拟器

  2. 使用命令行

1
2
进到 sdk/ 目录下
tools/android avd