MaterialDrawer库的Gradle配置

昝阳嘉
2023-12-01

环境:

win7系统

Android studio版本2.3.3


关键点:

1、在Project的gradle文件中添加 

maven { url "https://maven.google.com" }

2、可能要在AS的菜单"File->Setting“中设置代理。 

几个Activity,正常的Gradle Build时间,应在1分多钟。


Project的build.gradle文件:

// 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:2.3.3'
        classpath "io.realm:realm-gradle-plugin:3.7.2"
        classpath 'com.novoda:bintray-release:0.3.4'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://jitpack.io' }
        maven { url "https://maven.google.com" }
    }
}

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

App的build.gradle文件:

apply plugin: 'com.android.application'
apply plugin: 'realm-android'

android {
    compileSdkVersion 26
    buildToolsVersion "26.0.2"
    defaultConfig {
        applicationId "com.foxmail.yusp75.myexam"
        minSdkVersion 16
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        vectorDrawables.useSupportLibrary = true
        //testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            //  application

            versionNameSuffix 'MyExam'
        }
        debug {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            //  application

            versionNameSuffix 'MyExam'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
        exclude module: 'jsr305'
    })
    compile 'com.android.support:support-v4:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile 'com.android.support:support-annotations:26.0.0-alpha1'
    compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
    compile 'com.android.support:support-vector-drawable:26.0.0-alpha1'
    compile 'com.android.support:design:26.0.0-alpha1'
    compile('com.mikepenz:materialdrawer:5.9.5@aar') {
        transitive = true
    }

    testCompile 'junit:junit:4.12'
    compile project(':FileChooser')

}


 类似资料: