简体   繁体   English

Android Studio项目结构VS build.gradle

[英]Android Studio project structure VS build.gradle

I'm trying to add a maven repository to my project by adding it to build.gradle 我正在尝试通过将Maven存储库添加到build.gradle将其添加到我的项目中

repositories {
    maven {
        url "https://XXX/"
    }
}

It works fine when I build in the console. 当我在控制台中构建时,它工作正常。 When I try to build it with Android Studio, the dependency that I use in that repository is not found. 当我尝试使用Android Studio构建它时,找不到在该存储库中使用的依赖项。

When I add the repository to File > project structure > project > Default library Repository bam! 当我将存储库添加到文件>项目结构>项目>默认库存储库bam时! it works. 有用。

What am I doing wrong? 我究竟做错了什么? why do I have to duplicate the information? 为什么我必须重复这些信息? What is exactly the purpose of that configuration since it's already in build.gradle file? 由于该配置已经在build.gradle文件中,因此它的确切目的是什么?

Thank you 谢谢

    Aghilas, i am not sure if it is issue with https or http. 
I am putting down what works for me. you can add 'maven()' in the block depending on that repo is required for buildscript functionality or for your app.

    buildscript {

        repositories {
            google()
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:3.3.2'


            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }

    allprojects {
        repositories {
            google()
            jcenter()
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM