对于一个新建好的app包,第一步需要先修改build参数

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"
    defaultConfig {
        applicationId "com.example.administrator.myapplication"
        minSdkVersion 15
        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'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.+'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
}
buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.0'
    }
}

根据自身版本系红色字体地方进行修改,随后点击try again,直到软件不报错为止。

新建的一个app程式内,结构如下图所示

android studio项目基础结构(android 01)

图中,manifests内存储的为布局结构图,即前段显示界面的代码,为xml文件;

java内存储的为后端java代码,即前段界面显示的控件被操作后的执行方法和执行动作;

res为资源文件存储处,里面用来存储该app需要的各种资源文件,如图片,视频,文件等等。




相关文章: