[Android Studio] For newbies, the installation and creation of project builds are very slow, and downloading dependencies is very slow.

A little nonsense, you can skip it directly:

        I have never used Android Studio, nor have I learned it. I have almost no basis in using this software. I may not know many of the principles. I can only say that it is correct or usable. This is the first time. I’m not very good at blogging, so the big guys are merciful. I haven’t seen the running sample template yet. There was a problem when importing the project at the beginning. It took me an afternoon of trouble to solve it. Maybe the process was "idiotic".

process:

1. Create a new project: File--New Project. I selected a template here and click Next.

Create a new project here:

Fill in your name in the first column.

The second column will automatically generate a package name based on your name.

The third one is the save location. You can default or set a location yourself.

The fourth is the language used. You can choose java, but when I set it up earlier, I didn’t notice that except for the name, it was the default.

The fifth is the lowest supported version. It is said online that the lower the version, the less likely it is to have compatibility issues. In short, choose one that is used by many people, such as the default version.

I don’t know what the sixth one is. I default to it and click Finish to start importing the project.

2. Import project

This may take a lot of time and is very slow. There is something at the bottom that shows the process, which is Gradle: Configure the project. Click here.

You can see that a background task pops up, and it is very slow. At this time, click on the little hammer in the picture above, and there is a build

You can see the following, click on the small red square to stop, configure first, wait and then re-run the build to make the changes take effect.

3. Change this project to the project structure here on the left, because it is possible to open the Android project structure and find the file settings.gradle.kts (if it is Java, it is build.gradle. The writing method is a bit different. The main thing here is Speaking of kotlin, this is also a place to troubleshoot)

4. Add the domestic mirror source of maven. Basically, aliyun is used. I don’t know if other companies have it. Just write it like this. (Whether mavenLocal is annotated or not should have no impact, but there are a few points to pay attention to, which is why I took so long)

5. Which icon is the built icon, or click on the file--Sync Project with Gradle files

Notice:

1. First, version issues:

       You can refer to it firstAndroidStudio gradle slow download problem, configure Alibaba Cloud_lizhengwei1989's blog-CSDN blogThis big guy's writing should be No problem. If there is an error during the build Unexpected tokens (use ';' to separate expressions on the same line); that means the new version has changed the writing method, just write it like this, from thisSolve the problem of maven error reporting introduced in AndroidStudio 2022.3.1 version_zhang106209's blog-CSDN blogLearned from the boss. (I didn’t see this article when I first searched for it. It was said that variables and declarations cannot be on the same line, so I just hit Enter and branched [laughing]. It didn’t say that the format was wrong, but a new error was reported. According to this The mistake has been made for a long time, and it is even more outrageous. Don’t imitate me)

My writing method and code:

maven { url=uri("https://maven.aliyun.com/repository/gradle-plugin") }
maven { url=uri("https://maven.aliyun.com/repository/spring-plugin") }
maven { url=uri("https://maven.aliyun.com/repository/public") }
maven { url=uri("https://maven.aliyun.com/repository/google") }
maven { url=uri("https://jitpack.io")}
2. The second point

        There are some articles that will teach you to add this image to the build.gradle file, but I got an error after adding it, which is also a problem with the new version. Just don’t add it. You can refer to this expert. Build was configured to prefer settings repositories over project repositories but repository 'maven-CSDN blog

Summarize

        In fact, my main reason is because of the first reason. Because the language I chose is kotlin, it takes a lot of time to download the package. If I use Java language, Java is installed when installing Android Studio, and the general dependencies are all It's relatively small, so it should be pretty fast to build. Then you can start writing programs, or look for articles from other experts to see how to configure the simulator and see the effect (but when I was writing the blog, I realized that the language seemed to be wrong. Do I have to rewrite it? [Crazy ][Twisted][Lie on the ground][Crawling everywhere])

Guess you like

Origin blog.csdn.net/m0_49476792/article/details/133773283