Tag: equals Google jar package API root rar sts Match style
Recently, in the study of the application automation-related things, in the setting up of the environment, the pit and the final solution to the method, here to record:
The first is the build configuration file:
1 represents the build configuration file under the project, and 2 represents the build configuration file for the module directory, such as:
1) The build file configuration under the project, mainly includes the following content:
1, repositories closed bag
This closure declares the configuration of Jcenter (), where Jcenter is a code-managed warehouse that hosts many Android open source projects, where jcenter can be conveniently referenced in the project for open source projects on Jcenter.
2, dependencies closed bag
The closure uses CLASSPATH to declare a gradle plugin, since gradle is not just used to build an Android project, so the plugin is introduced here to build the Android project, where ' 3.0.1 ' is the version number of the plugin, which can be adjusted according to the latest version number. The specific configuration is as follows:
//top-level build file where can add configuration options common to all sub-projects/modules.Buildscript {repositories {//use the Maven repository. Android has two standard library file servers, one jcenter a maven. There is no relationship between the two. //Jcenter Some maven may not, and vice versa. //If you want to use Jcenter, replace mavencentral () with Jcenter ()Google () jcenter ( )//mavencentral ()} dependencies {classpath' com.android.tools.build:gradle:3.0.1 '//Note:do not place your application dependencies here; they belong//In the individual module build.gradle files }}//top-level build file where can add configuration options common to all sub-projects/modules.Buildscript {repositories {jcenter ()//mavencentral ()} dependencies {classpath' com.android.tools.build:gradle:3.0.1 '//Note:do not place your application dependencies here; they belong//In the individual module build.gradle files}}allprojects {repositories {Google () Jcenter ()//mavencentral ()//maven {URL "http://18.8.10.110: 8081/nexus/content/repositories/releases/"}}}task Clean (type:delete) {Delete Rootproject.builddir}
2) The build file configuration under the module directory, mainly includes the following content:1, Defaultconfig closed bag
More details on the project are configured, where ApplicationID specifies the package name of the project, and we can modify the item's package name by modifying the value.2, Buildtypes closed bag
This closure mainly specifies the main configuration to generate the installation files, typically contains two sub-closures, one is the debug closure, to specify the configuration to generate the test version of the installation file, can be ignored, the other is release closure, used to specify the configuration to generate the official version of the installation files.3, dependencies closed bag
The closure defines the dependencies of the project, and the general project has three dependencies: local dependencies, library dependencies, and remote dependencies. Local dependencies can add dependencies to a local jar package or directory, and library dependencies can add dependencies to the library modules in the project, and remote dependencies can add dependencies to open source projects on the Jcener library. The specific configuration is as follows:
//statement is an Android programApply plugin: ' Com.android.application 'Android {//Compile the SDK version, i.e. API level, such as API-23, API-24, API-25, etc.Compilesdkversion 26//build tools, which includes the packaging tools AAPT, DX, and more. //The directory for this tool is located under your SDK directory/build-tools/Buildtoolsversion ' 26.0.2 'Defaultconfig {//App Package nameApplicationID "Com.cxq.myapplication"//Minimum SDK version, if the device is less than this version or greater than maxsdkversion (typically not used) will not install the appMinsdkversion 26//Target SDK version, if the device equals this version then the Android platform does not perform a compatibility check, the efficiency will be higher.Targetsdkversion 26//version updated several times, the first version of the application is 1, after each update plus 1Versioncode 1//version information, this will be displayed to the user, that is, the version number that the user seesVersionname "1.0"Testinstrumentationrunner"Android.support.test.runner.AndroidJUnitRunner"} buildtypes {release {//configuration of Release versionMinifyenabledfalse //whether to confuse//The Proguard of release defaults to the Proguard-rules.pro file under module.Proguardfiles getdefaultproguardfile (' proguard-android.txt '), ' Proguard-rules.pro 'Matchingfallbacks= [' Release ', ' Debug '] } }}//a number of dependent frameworksDependencies {Implementation Filetree (include: [' *.jar '], dir: ' Libs ') Implementation' com.android.support:appcompat-v7:26.1.0 'testimplementation' junit:junit:4.12 'androidtestimplementation' com.android.support.test:runner:1.0.1 'androidtestimplementation' com.android.support.test.espresso:espresso-core:3.0.1 'androidtestimplementation' com.android.support.test:rules:1.0.1 'Implementation' com.android.support.test.uiautomator:uiautomator-v18:2.1.3 '//implementation files (' Libs/uiautomator.jar ')//implementation ' com.gionee.autotests.common:common-lib:1.0.7 '//implementation ' com.gionee.android.autotests.common:android-common:+ '}
There are some other setup issues, follow up to do updates;
ANDROIDSTUDIO3.0-based build file configuration issues