1. Import as Project
Create a new project a locally, the project directory is as follows
Item B on GitHub, project catalog is as follows
Replace the four files/folders of the locally created project A with the same content from GitHub on item B, and select Build in the root directory of Project B through Open an existing project or File/new/import project mode After you import the. gradle file, modify the Build.gradle:1 in the module. Compilesdkversion, Buildtoolsversion, minsdkversion, targetsdkversion change to the local SDK corresponding to version 2. Comment out irrelevant applicationid, apply plugin: ..., apply from: ..... such as the following error occurs
Check the build.gradle in the root of the project, remove the android {compilesdkversion buildtoolsversion ' 23.0.3 '} Note: as when importing the project, it will automatically find if there is a project configuration file in the SDK version, the above code 2 will be added to the Build.gradle in the project root directory. Import as Module 1) method one: By File/new/import module, select the module folder in item B (i.e., duplicate the folder name, rename it, such as: Module2); method Two: Direct the Modul in Project B E, the App folder in the copy to local project A, such as duplicate folder name, rename it, such as: MODULE22) Modify the Settings.gradle in the root of the project A, add the Modole2:include ': App ', ': Module2 ' (Settings.gradle in the project root directory is set to Gradle, including all module) 3) synchronization Gradle
Android Studio Import Project and module, take project on GitHub as an example