AS的下载安装,使用可以参照:
http:
1.新建的工程
Compile Sdk Version: API 25: Android 7.1.1 (Nougat) ----决定的是目标机型,需要API 25的支撑
注意点: Minimun SDK选择 API 21 : Android 5.0,不要选择高版本的,严重者工程都新建不了
2.工程打开后的各种错误
(1) build.gradle(Project)
正确的代码如下:
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.3'
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
(2)build.gradle(自己的Module,默认是app)
正确的代码如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.1"
defaultConfig {
applicationId "com.example.chenl_fnst.a7_1test"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
aaptOptions.setProperty("cruncherEnabled",false)
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
}
至此,编译默认app无错误;