Android aar依赖项是’;t解析依赖于.aar的应用程序内项目
我在android studio 2.1.3中创建了一个android库AAR,其中使用了以下依赖项:Android aar依赖项是’;t解析依赖于.aar的应用程序内项目,android,gradle,dependencies,android-gradle-plugin,aar,Android,Gradle,Dependencies,Android Gradle Plugin,Aar,我在android studio 2.1.3中创建了一个android库AAR,其中使用了以下依赖项: compile 'com.google.android.gms:play-services-vision:9.4.0+' compile 'com.google.android.gms:play-services-wearable:9.4.0+' compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3' 现在我在一个应用程序中使用这个
compile 'com.google.android.gms:play-services-vision:9.4.0+'
compile 'com.google.android.gms:play-services-wearable:9.4.0+'
compile 'pl.droidsonroids.gif:android-gif-drawable:1.2.3'
现在我在一个应用程序中使用这个aar,但是这些依赖项失败了,除非我将它们添加到新应用程序的依赖项中
我在这里搜索,发现我需要添加以下行:
compile (project(':LIBNAME-release')) {transitive = true}
但这不起作用。我错过了什么吗?还是与我对aar文件所做的混淆有关?还是必须将这些依赖项添加到应用程序中?请按照以下步骤进行操作(我已经在Android Studio 2.2上对其进行了测试) 假设您已将aar文件保存在libs文件夹中。(假设文件名为cards.aar) 然后在app build.gradle中指定以下内容,并单击“将项目与gradle文件同步”
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile(name:'cards', ext:'aar')
}
如果一切顺利,您将看到库条目是在build->aar中创建的
还请注意,如果您要从另一个具有依赖项的项目导入.aar文件,那么您也需要将这些文件包含在build.gradle中
请按照以下步骤操作以使其正常工作(我已经在Android Studio 2.2上对其进行了测试) 假设您已将aar文件保存在libs文件夹中。(假设文件名为cards.aar) 然后在app build.gradle中指定以下内容,并单击“将项目与gradle文件同步”
allprojects {
repositories {
jcenter()
flatDir {
dirs 'libs'
}
}
}
dependencies {
compile(name:'cards', ext:'aar')
}
如果一切顺利,您将看到库条目是在build->aar中创建的
还请注意,如果您要从另一个具有依赖项的项目导入.aar文件,那么您也需要将这些文件包含在build.gradle中
首先尝试编译您的项目:
dependencies {
compile project(':Name-Of-Your-Project')
}
这是Ashton Engberg从中提出的建议,首先尝试编译您的项目:
dependencies {
compile project(':Name-Of-Your-Project')
}
这是Ashton Engberg在中的建议,这是我现在正在使用的。但是这个项目要求我在aar中使用依赖项。我是否应该在应用程序中使用除AAR之外的其他依赖项?这就是我现在使用的。但是这个项目要求我在aar中使用依赖项。我应该在应用程序中使用依赖项而不是AAR,然后我需要在其他项目中添加依赖项。感谢您的回复。我需要在其他项目中添加依赖项。谢谢你的回复