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


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


2、修改文件

假設,解壓后的文件目錄如下:

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

  
  
  
          
  1. // Top-level build file where you can add configuration options common to all sub-projects/modules.
  2. buildscript {
  3.    repositories {
  4.        jcenter()
  5.    }
  6.    dependencies {
  7.        classpath 'com.android.tools.build:gradle:1.3.0'
  8.        // NOTE: Do not place your application dependencies here; they belong
  9.        // in the individual module build.gradle files
  10.    }
  11. }
  12. allprojects {
  13.    repositories {
  14.        jcenter()
  15.    }
  16. }

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

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

(3)修改gradle.properties  xx\gradle.properties(如果項目有並且需要的話)

  
  
  
          
  1. ANDROID_BUILD_TARGET_SDK_VERSION=23  
  2. ANDROID_BUILD_TOOLS_VERSION=23  
  3. ANDROID_BUILD_SDK_VERSION=23

(4)修改Application\build.gradle   library\build.gradle   xx\library\build.gradle(如果項目有並且需要的話)

i、注釋掉這句代碼://apply from: 'https://raw.github.com/chrisbanes/gradle-mvn-push/master/gradle-mvn-push.gradle' (如果項目有並且需要的話)

ii、

  
  
  
          
  1.    compileSdkVersion 23
  2.    buildToolsVersion "23.0.1"
  3.    defaultConfig {
  4.        minSdkVersion 21
  5.        targetSdkVersion 23
  6.    }
  7.    compileOptions {
  8.        sourceCompatibility JavaVersion.VERSION_1_7
  9.        targetCompatibility JavaVersion.VERSION_1_7
  10.    }

3、打開Android Studio,導入修改后的工程



4、如果導入后沒有報錯,則說明運行OK


可能需要改動的文件:







免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM