Android Studio | How does a novice run other people’s Android projects?

Table of contents

Step1: Open the project correctly

Step2: An error occurs during AS synchronization

Step3: Start after synchronization is completed

Step4: Start successfully


Note: This article refers to Android Studio as AS

Step1: Open the project correctly

Key point: Confirm which directory the root directory of the project is!

Others send us the project in the form of a ZIP compressed package. We decompress the compressed package and get the project folder. Since a layer of directories is often added when making a compressed package, and this layer is not the root directory of the project, misusing it as the root directory will cause AS to fail to recognize the project structure.

Click "Open" and select the root directory of the project to open:

If all directories are gray after opening and there is no prompt from AS, then you may have found the wrong root directory.

Step2: An error occurs during AS synchronization

Once the project has been opened correctly, AS will automatically synchronize. But I'm getting the following error while syncing:

Caused by: org.gradle.api.internal.plugins.PluginApplicationException:
Failed to apply plugin 'com.android.internal.application'.

First, find the gradle.properties file:

Then, add a line to gradle.properties:

android.overridePathCheck=true

Finally, click "Try Again" to resynchronize:

Reference blog: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin

Step3: Start after synchronization is completed

After successful synchronization, the project structure will be organized by AS, similar to the following figure:

Click the green triangle to start the project. What I have here is after startup, so it looks different:

You may encounter the following error, that is, the minimum version number of the SDK required by the project is higher than the version of your AVD:

The application's minSdkVersion is newer than the device API level.

It doesn't matter, we just need to lower the minimum SDK version number required by the project. Here, directly use the keyboard to enter the minimum version number you want, because the drop-down options it provides may not have what you want. As shown below:

Step4: Start successfully

AS will automatically install the project's apk, that is, install the project's app. I won't show it here when it comes to project privacy:

Guess you like

Origin blog.csdn.net/m0_64140451/article/details/135306159