Crouton依赖于图书馆但不是图书馆本身

Ily*_*min 38 android gradle crouton android-studio

我正在使用Android Studio 0.6.1,使用Crouton库,今天在gradle sync之后我遇到了下一个错误:

Error:A problem occurred configuring root project 'project_name'.
Module version de.keyboardsurfer.android.widget:crouton:1.8.4 depends on libraries but is not a library itself
Run Code Online (Sandbox Code Playgroud)

那是怎么回事?

Ily*_*min 61

这个问题是由于com.android.support-v4最近的更新.

所以我改变了

compile 'com.android.support:support-v4:20.+'
Run Code Online (Sandbox Code Playgroud)

compile 'com.android.support:support-v4:19.1.+'
Run Code Online (Sandbox Code Playgroud)

和crouton工作得很好

不同的解决方法是使用@aar:

compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
    exclude group: 'com.google.android', module: 'support-v4'
}
Run Code Online (Sandbox Code Playgroud)

  • 对我来说,**不同的解决方法**工作 (6认同)
  • 目前Crouton仍然是一个罐子.即将推出的版本将仅作为aar部署并使用`com.android.library`插件. (2认同)

dea*_*ish 7

我的解决方案根据@Revedko回答,使用@aar并将所有支持更改为低于21的版本 - > 20. +

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.loopj.android:android-async-http:1.+'
    compile "com.bugsense.trace:bugsense:3.5"
    compile('de.keyboardsurfer.android.widget:crouton:1.8.4@aar') {
        exclude group: 'com.google.android', module: 'support-v4'
    }
    compile 'com.android.support:appcompat-v7:20.+'
    compile 'com.google.android.gms:play-services:5.0.77'
}
Run Code Online (Sandbox Code Playgroud)