gradle添加新的代码仓库

本文介绍了如何在Android Studio中更改默认的代码仓库,从jcenter切换到其他仓库,以获取未在jcenter上发布的第三方项目依赖。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Android Studio修改代码仓库


  在Android Studio 中默认的代码仓库是jcenter但是我们使用的第三方的项目也许没有上传到jcener上那么我们就需要改变我们grad了时的代码仓库来得到我们想要的文件,具体build.gradle文件的修改如下:


android {
    compileSdkVersion 23
    buildToolsVersion '23.0.2'
    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 52
        versionName '3.0.0'
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        sourceSets {
            main {
                java.srcDirs = ['src']
                res.srcDirs = ['res']
                assets.srcDirs = ['assets']
                manifest.srcFile 'AndroidManifest.xml'
            }
        }
    }

    buildTypes {

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

    lintOptions {
        abortOnError false
    }
}

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        //classpath 'io.realm:realm-gradle-plugin:0.88.2'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

repositories {
    maven { url 'https://jitpack.io' }
    maven { // this is for realm-db
        url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
    }
}

dependencies {
    //compile fileTree(dir: 'libs', include: ['*.jar'])
    //compile project(':MPChartLib-Realm') // clone "https://github.com/PhilJay/MPAndroidChart-Realm" to get this or uncomment the gradle dependency below:
    compile 'com.github.PhilJay:MPAndroidChart-Realm:v1.1.0@aar'
    compile project(':MPChartLib')
    compile 'com.android.support:appcompat-v7:23.1.1'
    //compile 'io.realm:realm-android:0.87.5' // dependency for realm-database API (http://realm.io)
    //compile 'com.github.PhilJay:MPAndroidChart:v2.2.5'
    //compile 'org.quanqi:mpandroidchart:1.7.5'
}


 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值