gpt4 book ai didi

android - 无法解析 : project :Library:materialDrawer

转载 作者:行者123 更新时间:2023-11-30 00:22:12 28 4
gpt4 key购买 nike

我正在尝试将 mikepenz 的 Material Drawer 添加为第三方项目。我想将它添加为项目的原因(不仅仅是编译为依赖项)以便我可以根据我的要求修改抽屉的 UI。但是我无法成功同步我的 gradle 并收到以下错误:

Failed to resolve:project :Library:materialDrawer

这是我的项目结构:

-> root
->app
->Library
-> materialDrawer
-> app
-> build.gradle
-> settings.gradle
-> build.gradle(project)
-> settings.gradle

我试着关注这个项目 https://github.com/foragerr/android-multi-project-sample/blob/master/settings.gradle但在静脉。

这是我的build.gradle(我的项目)文件:

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
classpath 'com.novoda:bintray-release:0.3.4'
}
}

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

settings.gradle(我的项目)

include ':app', ':Library:materialDrawer'

build.gradle(应用:我的项目)

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

android {
compileSdkVersion 25
buildToolsVersion '25.0.0'

defaultConfig {
applicationId "com.******"
minSdkVersion 15
targetSdkVersion 25
versionCode 38
versionName "2.1.8"

generatedDensities = []

}

dexOptions {
javaMaxHeapSize "4g"
}

aaptOptions {
additionalParameters "--no-version-vectors"
}

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

tasks.whenTaskAdded { task ->
if (task.name.equals("lint")) {
task.enabled = false
}
}

repositories {
mavenCentral()
maven { url "https://jitpack.io" }
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
/*
compile('com.mikepenz:materialdrawer:5.6.0@aar') {
transitive = true
}
*/
compile project(':Library:materialDrawer')
compile 'com.android.support:appcompat-v7:25.0.1'
compile 'com.android.support:design:25.0.1'
compile 'com.android.support:support-v4:25.0.1'
compile 'com.android.support:recyclerview-v7:25.0.1'
compile 'com.android.support:cardview-v7:25.0.1'
compile 'com.google.android.gms:play-services-maps:10.2.0'
compile 'com.google.android.gms:play-services-location:10.2.0'
compile 'com.google.firebase:firebase-messaging:10.2.0'
compile 'com.google.firebase:firebase-core:10.2.0'
compile 'com.google.firebase:firebase-crash:10.2.0'
compile 'com.facebook.android:facebook-android-sdk:4.7.0'
compile 'com.loopj.android:android-async-http:1.4.9'
compile 'uk.co.chrisjenx:calligraphy:2.1.0'
compile 'com.squareup.picasso:picasso:2.5.2'
compile 'com.google.code.gson:gson:2.2.4'
compile 'com.nineoldandroids:library:2.4.0'
compile 'com.daimajia.slider:library:1.1.5@aar'
compile 'com.github.ParkSangGwon:TedPermission:v1.0.12'
compile 'hanks.xyz:smallbang-library:0.1.2'
compile 'com.yalantis:ucrop:2.2.0'
compile 'com.github.clans:fab:1.6.4'
compile 'me.zhanghai.android.materialratingbar:library:1.0.2'
compile 'com.android.support.constraint:constraint-layout:1.0.0'
}

apply plugin: 'com.google.gms.google-services'

build.gradle(项目:materialDrawer)

buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.1'
classpath 'com.google.gms:google-services:3.0.0'
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 {
maven {
url 'https://maven.google.com'
}
jcenter()
}
}

我的 Android Studio 是 v2.3.3。我挠头但找不到任何解决方案。请有人帮助我,我坚持了三天......

最佳答案

因为您正在使用:

compile project(':Library:materialDrawer')

gradle 正在该模块中寻找 build.gradle。检查您的问题,此文件存在但它是顶级 文件而不是模块文件

你应该以这种方式改变结构(你不应该把库文件夹放在另一个模块中)

-> root
->app
-> build.gradle
->Library
-> materialDrawer
-> app
-> build.gradle
-> build.gradle
-> settings.gradle
-> build.gradle(project)
-> settings.gradle

您必须更改 settings.gradle :

include ':app', ':materialDrawer'
project(':materialDrawer').projectDir = new File('/Library/materialDrawer/app')

然后作为依赖使用:

compile project(':materialDrawer')

关于android - 无法解析 : project :Library:materialDrawer,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46070588/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com