0

我想将此依赖项添加到gradle,但我收到了有关其他依赖关系的错误,这些错误并未在第一位添加。无法添加Gradle依赖项

错误:

enter image description here

依赖我想补充的是com.wdullaer:materialdatetimepicker:3.1.3

的build.gradle文件

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 24 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.pf.datetimepicker" 
     minSdkVersion 21 
     targetSdkVersion 24 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:+' 
    compile 'com.wdullaer:materialdatetimepicker:3.1.3' 
} 
+0

永远不要使用':+'作为版本号 –

回答

1

我没有在第一位添加。

当然你做......

看一下你得到的库源。 https://github.com/wdullaer/MaterialDateTimePicker/blob/master/library/build.gradle

compile 'com.android.support:support-v4:25.2.0' 
compile 'com.android.support:support-v13:25.2.0' 
compile 'com.android.support:design:25.2.0' 

首先,你需要compileSdkVersion 25对于那些甚至工作,那么你需要让Android Studio中的“安装信息库和同步工程”或自己做,通过更新SDK管理器。

1

更改您的compileSdkVersionbuildToolsVersiontargetSdkVersion

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 25 
    buildToolsVersion "25.0.2" 
    defaultConfig { 
     applicationId "com.pf.datetimepicker" 
     minSdkVersion 21 
     targetSdkVersion 25 
     versionCode 1 
     versionName "1.0" 
     testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    compile 'com.android.support:appcompat-v7:+' 
    compile 'com.wdullaer:materialdatetimepicker:3.1.3' 
} 
+0

小改正:buildToolsVersion必须是'25.2.0' –

+0

实际上它应该是“25.0.2”,因为“25.2.0”尚不可用,但是与双引号是好的 – MarcGV

1

你的编译和targetsdk更改为25

0

您尚未安装Android的支持库的最新版本。只需打开SDK管理器并安装它们。 See the image

相关问题