簡體   English   中英

生成簽名的apk時gradle構建錯誤

[英]gradle build error while generating signed apk

我已經創建了一個可以隨時從Playstore上傳的應用。 我已經創建了密鑰庫密碼,並且在構建gradle時都得到了以下錯誤。 這是我第一次在Playstore上載應用程式。 以下是錯誤和build.gradle文件...請幫助我!有關上傳應用程序的其他信息非常有幫助

錯誤:

Information:Gradle tasks [:app:assembleRelease]
Warning:okhttp3.Address: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Authenticator: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$2: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$CacheResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cache$Entry: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.CacheControl: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.CertificatePinner: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Challenge: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Connection: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionPool: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionSpec: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ConnectionSpec$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Cookie: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Dispatcher: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.EventListener: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.FormBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Handshake: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Headers: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.HttpUrl: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.HttpUrl$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Interceptor$Chain: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MediaType: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.MultipartBody$Part: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.OkHttpClient: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.OkHttpClient$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Request: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Request$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$1: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$2: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.RequestBody$3: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Response: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Response$Builder: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.ResponseBody$1: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.Route: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.WebSocket: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.WebSocketListener: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.Util: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.CacheStrategy: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.DiskLruCache: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.cache.DiskLruCache$Snapshot: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.connection.RealConnection: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.http.RealResponseBody: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.internal.ws.RealWebSocket: can't find referenced class javax.annotation.Nullable
Warning:okhttp3.package-info: can't find referenced class javax.annotation.ParametersAreNonnullByDefault
Warning:okio.AsyncTimeout: can't find referenced class javax.annotation.Nullable
Warning:okio.Buffer: can't find referenced class javax.annotation.Nullable
Warning:okio.BufferedSource: can't find referenced class javax.annotation.Nullable
Warning:okio.ByteString: can't find referenced class javax.annotation.Nullable
Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.HashingSink: can't find referenced class javax.annotation.Nullable
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio$4: can't find referenced class javax.annotation.Nullable
Warning:okio.RealBufferedSource: can't find referenced class javax.annotation.Nullable
Warning:okio.Segment: can't find referenced class javax.annotation.Nullable
Warning:okio.SegmentPool: can't find referenced class javax.annotation.Nullable
Warning:okio.package-info: can't find referenced class javax.annotation.ParametersAreNonnullByDefault
Warning:there were 181 unresolved references to classes or interfaces.
Warning:Exception while processing task java.io.IOException: Please correct the above warnings first.
Error:Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
> Job failed, see logs for details
Information:BUILD FAILED in 5m 31s
Information:1 error
Information:63 warnings
Information:See complete output in console

的build.gradle(APP)

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    buildToolsVersion '26.0.2'
    defaultConfig {
        applicationId "com.abcd.efgh"
        minSdkVersion 19
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled true
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:11.6.0'
    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.readystatesoftware.systembartint:systembartint:1.0.3'
    compile 'com.google.android.gms:play-services-ads:11.6.0'
    compile 'com.wdullaer:materialdatetimepicker:3.4.0'
    compile 'com.android.support:design:27.0.2'
    compile 'com.android.support:appcompat-v7:27.0.2'
    compile 'com.squareup.okhttp3:okhttp:3.9.0'
    testCompile 'junit:junit:4.12'
}


apply plugin: 'com.google.gms.google-services'

您已將minifyEnabled true以便發布,並且可能需要javax.annotation.Nullable一些必需的類,但可以通過縮小將其刪除。 如果您暫時不需要它,則可以刪除該標簽以進行發布。 如果確實需要該標志,則必須修補並配置minify以保留該類。

在我看來,這是一個傳遞依賴問題。 正如您不想重新創建滾輪並很好地使用gradle導入其他代碼一樣,gradle依賴項的創建者也不想重新創建滾輪以太,因此他們也使用了gradle。 最后,您會得到嵌套的依賴關系,這些依賴關系可能不使用最新版本。 實際上,您甚至在androidtestcompile版本中都排除了group:'com.android.support',module:'support-annotations'以避免傳遞依賴沖突。 我感到你很痛苦。 我將轉到gradle選項卡,嘗試運行名稱中具有依賴性的任何任務。 跟蹤此類錯誤非常冗長,列出的堆棧跟蹤將有所幫助。 運行lint還可以幫助清理您的代碼,並且正如Yordan所提到的那樣,不需要proguard,但是它通過混淆代碼來增加安全性

暫無
暫無

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

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