应用 Android Studio 插件失败

17

我正在尝试将ExoPlayer库导入到我的Android Studio项目中。我已经尝试过几次不同的方法(使用GRADLE直接导入,作为模块导入,复制粘贴等),但都遇到了相同的错误:

Error:(15) A problem occurred evaluating project ':..:ExoPlayer:library'.
> Failed to apply plugin [id 'bintray-release']
   > Plugin with id 'bintray-release' not found.

在 Gradle 库中我找到了 apply plugin 的代码行:

apply plugin: 'bintray-release'

在搜索库并将其应用于依赖项后,我仍然遇到了错误:

dependencies {
    compile 'com.novoda:bintray-release:0.2.10'
}

有什么办法可以解决这个问题吗?

1个回答

28

看起来 gradle 在所有指定的仓库中都找不到该插件。ExoPlayer 在根项目中指定了 buildscript 仓库,因此您也应该这样做。

在您的根 build.gradle 中确保 buildscript 部分包含 jcenter() 仓库和 'com.novoda:bintray-release:0.2.7' 类路径:

buildscript {
    repositories {
        ...... <- whatever you have now
        jcenter() <- make sure this one is there
    }
    dependencies {
        ...... <- whaterver you have now
        classpath 'com.novoda:bintray-release:0.2.7' <- make sure this one is there
    }
}

2
是的,那就是问题所在,但这很愚蠢。如果我在库gradle中已经有了它,为什么还要在主项目gradle中再次添加呢?不过,知道这点还是很好的,谢谢! - Marian Pavel
你是对的 - 这应该在库的 Gradle 配置文件中。欢迎向 ExoPlayer 项目提交合并请求。 - Pavel Dudka
在我的情况下,它仍然会出现错误。放置了这行代码后,我应该做什么? - Pravinsingh Waghela
3
@PavelDudka请更新答案..它不起作用..在添加了最新的依赖项后,只有我的问题得到解决 classpath 'com.novoda:bintray-release:0.3.4' - Ranjithkumar
1
现在我遇到了一个问题:“错误:(23,0)无法在已解析之后更改配置“:..:ExoPlayer:classpath”的依赖项。” 有人能帮我吗? - thomasb
显示剩余4条评论

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接