2017-07-29 55 views

回答

1

補充一點:在您的BUI ld gradle

buildscript { 
    repositories { 
     maven { 
      url 'https://maven.google.com' 
     } 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha4' 

    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 

task clean(type: Delete) { 
    delete rootProject.buildDir 
} 
1

這是一個構建版本的Gradle問題。 項目層面構建文件

dependencies { 
     classpath 'com.android.tools.build:gradle:2.3.3' 
    } 

改變

dependencies { 
     // classpath 'com.android.tools.build:gradle:2.1.2' 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha6' 
     } 

,並添加庫

repositories { 
     jcenter() 
     google() 
    } 

最終構建文件,如:

// Top-level build file where you can add configuration options common to all sub-projects/modules. 

buildscript { 
    repositories { 
     jcenter() 
     google() 
    } 
    dependencies { 
     // classpath 'com.android.tools.build:gradle:2.1.2' 
     classpath 'com.android.tools.build:gradle:3.0.0-alpha6' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
}