2017-03-11 68 views
0

在gradle文件中出現一個錯誤,但它在控制檯中生成並且從未顯示,應用程序工作正常,但我認爲它會在其他設備上崩潰。Gradle出現錯誤,但構建正常

enter image description here

如何解決呢?我怎樣才能從工具提示中複製錯誤? 這裏是我的gradle產出:

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' 
} 

任何幫助,請......

回答

0

你看到這個錯誤是你的應用程序的依賴關係圖中包含了不同版本的支持庫的原因。儘管您的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項目提交問題,或者提交更新版本的拉取請求。