Coder Social home page Coder Social logo

gradle 集成失败问题 about androuter HOT 6 CLOSED

walfud avatar walfud commented on August 27, 2024
gradle 集成失败问题

from androuter.

Comments (6)

beautifulSoup avatar beautifulSoup commented on August 27, 2024

我这边貌似是可以的,我尝试找下原因。。

from androuter.

walfud avatar walfud commented on August 27, 2024

hey, 我发现问题了, 我必须要在 Project/build.gradle 中加入 maven { url ...} 才行. 我在 module/build.gradle 中加入是不行的... 这不应该的.
我再看看是不是加入的位置是否正确

from androuter.

beautifulSoup avatar beautifulSoup commented on August 27, 2024

哦,原来你这是一个文件 = ,=。 还有那个repository 应该是放在allprojects节点下的,buildscript是给gradle用的,而这里是表示你的项目依赖于这些repository,所以应该放在allprojects节点下。这是我的项目gradle文件,可以参考下。

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.1.2'
        classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'

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

allprojects {
    repositories {
        maven {
            url "https://jitpack.io"
        }

        maven {
            url "http://dl.bintray.com/populov/maven"
        }

        maven{
            url 'https://oss.sonatype.org/content/repositories/snapshots/'
        }

        jcenter()
    }
}

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

from androuter.

walfud avatar walfud commented on August 27, 2024

恩, 谢谢你的回复.
我们的主工程下有多个 module, 我放在 module/build.gradle 中也是为了不污染别的 module. 所以期望能把这个 module 依赖的东西都包在自己内部.
不过我们的 project 中的多个 module 之间还有相互引用, 所以最终还是不得已要写在 project/build.gradle 中.
谢谢你热心的回复.

from androuter.

beautifulSoup avatar beautifulSoup commented on August 27, 2024

我个人觉得放在project里面没有什么问题。buildscript里面的内容是只跟编译时用的gradle有关系的,表示gradle要依赖这些库,而跟项目本身关系不大。而在allprojects里面只需要加repository,只是表示项目内依赖的库可以从这些仓库里面找,只是标记了一下,也不会更改实际的项目内容,所以不会对moudle的实际内容产生影响。

from androuter.

walfud avatar walfud commented on August 27, 2024

恩, 你说的没错.

from androuter.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.