Android Gradle有一个错误,但它构建得很好
gradle文件中出现了一个错误,但它是生成的,从未在控制台中显示,应用程序运行良好,但我认为它将在其他设备上崩溃 我怎样才能修好它?如何从工具提示中复制错误? 这是我的毕业证书:Android Gradle有一个错误,但它构建得很好,android,api,gradle,runtime-error,android-appcompat,Android,Api,Gradle,Runtime Error,Android Appcompat,gradle文件中出现了一个错误,但它是生成的,从未在控制台中显示,应用程序运行良好,但我认为它将在其他设备上崩溃 我怎样才能修好它?如何从工具提示中复制错误? 这是我的毕业证书: apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.0" defaultConfig { applicationId "com.exam
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "com.example.mol.saherproject"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
compileOptions.encoding = 'ISO-8859-1'
multiDexEnabled true
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'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.mcxiaoke.volley:library:1.0.10'
compile 'com.google.android.gms:play-services:10.0.1'
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.android.support:support-v4:25.1.1'
compile 'com.android.support:design:25.1.1'
compile 'info.hoang8f:android-segmented:1.0.6'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'com.github.clans:fab:1.6.4'
compile 'com.google.maps.android:android-maps-utils:0.3.4'
compile 'com.android.support:multidex:1.0.1'
compile 'org.greenrobot:eventbus:3.0.0'
testCompile 'junit:junit:4.12'
}
请提供任何帮助……您看到此错误的原因是应用程序的依赖关系图包含不同版本的支持库。尽管build.gradle文件仅声明
25.1.1
,但另一个依赖项依赖于支持库版本24.0.0
。在命令行中运行以下命令以查看依赖关系的来源:
./gradlew -q dependencies
分析输出并记录出现的com.android.support:appcompat-v7:24.0.0
(或版本为24.0.0
的任何其他支持库)。依赖关系图可以很容易地将此依赖关系跟踪到根依赖关系,您的项目会显式声明根依赖关系
要解决此问题,请将可传递依赖项从使用它的模块中排除。例如,如果com.github.clans:fab:1.6.4
依赖于com.android.support:appcompat-v7:24.0.0
,则将声明更改为:
compile('com.github.clans:fab:1.6.4') {
exclude group: 'com.android.support'
}
然后,您必须确保项目中存在正确版本的appcompat-v7
此外,您可能希望向声明旧支持库依赖项的库的GitHub项目提交问题,或者提交更新版本的请求