在android studio中導入github下載的工程

一、從Github中下載工程壓縮包,並將其解壓到本地java


2、修改文件android

假設,解壓後的文件目錄以下:git

(1)修改配置文件  xx\build.gradlegithub

  
  
  
  
// Top-level build file where you can add configuration options common to all sub-projects/modules.buildscript {    repositories {        jcenter()    }    dependencies {        classpath 'com.android.tools.build:gradle:1.3.0'        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }}allprojects {    repositories {        jcenter()    }}

(2)修改gradle版本  xx\gradle\wrapper\gradle-wrapper.propertiesapp

  
  
  
  
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

(3)修改gradle.properties  xx\gradle.properties(若是項目有而且須要的話)gradle

  
  
  
  
ANDROID_BUILD_TARGET_SDK_VERSION=23  ANDROID_BUILD_TOOLS_VERSION=23  ANDROID_BUILD_SDK_VERSION=23

(4)修改Application\build.gradle   library\build.gradle   xx\library\build.gradle(若是項目有而且須要的話)ui

i、註釋掉這句代碼://apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' (若是項目有而且須要的話)
spa

ii、3d

  
  
  
  
   compileSdkVersion 23    buildToolsVersion "23.0.1"    defaultConfig {        minSdkVersion 21        targetSdkVersion 23    }    compileOptions {        sourceCompatibility JavaVersion.VERSION_1_7        targetCompatibility JavaVersion.VERSION_1_7    }

三、打開Android Studio,導入修改後的工程code



四、若是導入後沒有報錯,則說明運行OK


可能須要改動的文件:




相關文章
相關標籤/搜索