簡體   English   中英

應用發布APK上的依賴項存在沖突,但沒有調試?

[英]Dependencies conflict on app release APK, but not debug?

我已經修改代碼幾天了,但我無法讓Gradle為我組裝一個已簽名的APK(遵循錯誤代碼說明將導致構建成功,但是我的Google Calendar API失敗)。

dependencies {
// commented stuff is no longer used or commented for some other reason.
//compile 'com.android.support:appcompat-v7:27.1.0'

implementation 'com.android.support:support-vector-drawable:28.0.0'

implementation 'com.google.android.gms:play-services-ads:15.0.1'
//    Dont know whats up with these errors above. ^
//    they seem to work even though they are "incompatible"
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:support-v4:28.0.0'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.findbugs:jsr305:3.0.1'
implementation('com.google.api-client:google-api-client-android:1.23.0') {
    exclude module: 'guava-jdk5'
    //exclude group: 'org.apache.httpcomponents'
}
implementation 'com.android.support:multidex:1.0.3'
//implementation 'com.google.android.gms:play-services:12.0.1'
implementation 'com.android.support:cardview-v7:28.0.0'
//implementation 'com.android.support:support-v4:27.1.1'
implementation 'com.android.support:design:28.0.0'
implementation 'com.bartoszlipinski.constraint:staggeredanimationgroup:1.0.0'
implementation 'com.android.support:transition:28.0.0'
implementation 'com.google.android.gms:play-services-analytics:16.0.3'
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation 'com.google.firebase:firebase-messaging:17.3.2'
implementation 'com.google.firebase:firebase-inappmessaging-display:17.0.1'
implementation 'com.google.firebase:firebase-core:16.0.3'
/*Make sure these are always updated to the newest versions.*/
implementation('com.google.oauth-client:google-oauth-client-jetty:1.23.0') {
    exclude module: 'guava-jdk5'
}
implementation('com.google.apis:google-api-services-calendar:v3-rev305-1.23.0') {
    exclude module: 'guava-jdk5'
}
//implementation 'pub.devrel:easypermissions:0.3.0'
implementation 'com.google.http-client:google-http-client-jackson:1.15.0-rc'
//implementation 'com.google.android.gms:play-services-auth:16.0.0'

這些是我對Gradle文件的依賴。

忽略'com.android.support:support-vector-drawable:28.0.0'上的錯誤,因為它很好; 我只是無法讓我的APK組裝成簽名; 並且在強制執行時,我的Google日歷代碼不會返回事件。

Executing tasks: [:app:assembleRelease] Could not find google-services.json while looking in [src/nullnull/debug, src/debug/nullnull, src/nullnull, src/debug, src/nullnullDebug] registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) Could not find google-services.json while looking in [src/nullnull/release, src/release/nullnull, src/nullnull, src/release, src/nullnullRelease] registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection) :app:checkReleaseClasspath :app:preBuild UP-TO-DATE :app:preReleaseBuild :app:compileReleaseAidl NO-SOURCE :app:compileReleaseRenderscript UP-TO-DATE :app:checkReleaseManifest UP-TO-DATE :app:generateReleaseBuildConfig UP-TO-DATE :app:prepareLintJar UP-TO-DATE :app:mainApkListPersistenceRelease UP-TO-DATE :app:generateReleaseResValues UP-TO-DATE :app:generateReleaseResources UP-TO-DATE :app:processReleaseGoogleServices Parsing json file: C:\\Users\\Dylan\\Documents\\ClarenceFultonSecondary\\app\\google-services.json :app:mergeReleaseResources :app:createReleaseCompatibleScreenManifests UP-TO-DATE :app:processReleaseManifest :app:splitsDiscoveryTaskRelease UP-TO-DATE :app:processReleaseResources :app:generateReleaseSources :app:javaPreCompileRelease Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. :app:compileReleaseJavaWithJavac :app:compileReleaseNdk NO-SOURCE :app:compileReleaseSources C:\\Users\\Dylan\\Documents\\ClarenceFultonSecondary\\app\\build.gradle: Error: commons-logging defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses] C:\\Users\\Dylan\\Documents\\ClarenceFultonSecondary\\app\\build.gradle: Error: httpclient defines classes that conflict with classes now provided by Android. Solutions include finding newer versions or alternative libraries that don't have the same problem (for example, for httpclient use HttpUrlConnection or okhttp instead), or repackaging the library using something like jarjar. [DuplicatePlatformClasses] Explanation for issues of type "DuplicatePlatformClasses": There are a number of libraries that duplicate not just functionality of the Android platform but using the exact same class names as the ones provided in Android -- for example the apache http classes. This can lead to unexpected crashes. To solve this, you need to either find a newer version of the library which no longer has this problem, or to repackage the library (and all of its dependencies) using something like the jarjar tool, or finally, rewriting the code to use different APIs (for example, for http code, consider using HttpUrlConnection or a library like okhttp). 2 errors, 0 warnings :app:lintVitalRelease FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:lintVitalRelease'.

Lint在組裝發布目標時發現了致命錯誤。 要繼續,請解決lint所標識的問題,或按如下所示修改構建腳本:... android {lintOptions {checkReleaseBuilds false //或者,如果願意,您可以繼續檢查發行版本中的錯誤,//但是即使發現錯誤也繼續構建:abortOnError false}} ... *嘗試:使用--stacktrace選項運行以獲取堆棧跟蹤。 使用--info或--debug選項運行以獲取更多日志輸出。 與--scan一起運行以獲取完整的見解。 *在https://help.gradle.org在31秒內建立失敗獲得更多幫助

這是我的棉絨報告說的:

平台類重復

../../build.gradle:commons-logging定義了與Android現在提供的類沖突的類。 解決方案包括查找沒有相同問題的較新版本或替代庫(例如,對於httpclient使用HttpUrlConnection或okhttp替代),或使用jarjar之類的庫重新打包該庫。

../../build.gradle:httpclient定義的類與Android現在提供的類沖突。 解決方案包括查找沒有相同問題的較新版本或替代庫(例如,對於httpclient使用HttpUrlConnection或okhttp替代),或使用jarjar之類的庫重新打包該庫。

在app / build.gradle中添加以下代碼。

configurations {
    all {
        exclude module: 'httpclient'
        exclude module: 'commons-logging'
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM