首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >生成签名apk时出现gradle构建错误

生成签名apk时出现gradle构建错误
EN

Stack Overflow用户
提问于 2017-12-11 21:29:09
回答 2查看 967关注 0票数 0

我已经创建了一个应用程序准备上传到playstore。我已经创建了Keystore、password和all,当gradle构建时,我得到以下错误。这是我第一次在playstore上传应用程序。以下是错误和build.gradle file...Please帮助我!!有关上传应用程序的任何其他信息都非常有用

错误:

代码语言:javascript
复制
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(应用程序)

代码语言:javascript
复制
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'
EN

回答 2

Stack Overflow用户

发布于 2017-12-11 21:33:35

您有要发布的minifyEnabled true,也许需要一些javax.annotation.Nullable所需的类,但可以通过缩减将其删除。如果您现在不需要它,您可以删除该标签以进行发布。如果你确实需要这个标志,你必须修补和配置minify来保留这个类。

票数 1
EN

Stack Overflow用户

发布于 2017-12-11 22:11:38

在我看来,这是一个可传递的依赖问题。正如您不想重新创建轮子并使用gradle导入其他代码一样,gradle依赖项的创建者也不想重新创建轮子,所以他们也使用了gradle。您最终得到的嵌套依赖项可能不使用最新版本。实际上,您甚至在androidtestcompile版本中排除了group:'com.android.support',module:'support-annotations‘,以避免传递依赖冲突。我能感受到你的痛苦。我会转到gradle选项卡,尝试运行名称中包含依赖项的任何任务。跟踪这种类型的错误非常繁琐,您列出的堆栈跟踪将有所帮助。运行lint还可以帮助清理您的代码,正如Yordan提到的那样,proguard不是必需的,但它确实通过混淆代码来增加安全性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/47754052

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档