directory
- Writing in the front
- Create/Open a project
- Slow download gradle
- Gradle version incompatibilities
- Installing a VM
- run
Writing in the front
In just contact with Android Studio small white, start an installation package, can play four hours, a variety of pits one after another, you think you solved the bug, after running congratulations you unlock a new bug, don’t ask me how to know, said many are tears 🙃.
Let’s start with the installation, there are a lot of tutorials online, trouble is after the installation began.
Create/Open a project
New:
Open:
Choose the path
No matter open or new, in short into the main interface, after a load do not panic, click the lower right corner of the progress bar next to × :
Slow download gradle
The reason for dot × is that it takes too long to get off the Internet. Ali Cloud image is used here to directly replace the code in the figure:
Replace with:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}
}
dependencies {
classpath 'com. Android. Tools. Build: gradle: 3.0.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven{ url 'https://maven.aliyun.com/nexus/content/groups/public/'}}}task clean(type: Delete) {
delete rootProject.buildDir
}
Copy the code
Gradle version incompatibilities
Gradle plugin version is not compatible with Gradle plugin version, which leads to various bugs.
Lazy one-click copy and replace:
#Mon Dec 28 10:00:20 PST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https:/ / services.gradle.org/distributions/gradle-4.1-all.zip
Copy the code
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion '26.0.2'
defaultConfig {
applicationId "com.bignerdranch.android.geoquiz"
minSdkVersion 19
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(dir: 'libs', include: ['*.jar'])
androidTestCompile('com. Android. Support. Test. Espresso: espresso - core: 2.2.2', {
exclude group: 'com.android.support'.module: 'support-annotations'
})
//noinspection GradleCompatibleThe compile 'com. Android. Support: appcompat - v7:25.3.0' testCompile 'junit: junit: 4.12'}Copy the code
Then restart Android Studio and wait for the progress bar below to load.
Wait for the build progress bar again:
You can ignore the updated version, so the version Settings are good.
Installing a VM
However, we don’t have a device to run it yet. We can also connect the mobile phone. Here is how to install the VIRTUAL machine
Then choose the phone model, see you like to follow the fate, of course, low configuration of the computer recommended low resolution, otherwise run super card.
Click Download, which I’ve done before
You can name the virtual machine, or by default, click Finish
run
Then you can select your VIRTUAL machine and click the green arrow next to it to run
Start the virtual machine slowly for the first time
At this point, the first app has been successfully launchedU, °:.☆(~ ▽ ~)/$:Painted. °. God knows what I’ve been through.
Original is not easy, please do not reprint (this is not rich visits add insult to injury) blogger home page: blog.csdn.net/qq_45034708 If the article is helpful to you, remember to focus on the likes collection ❤