0

我已经创建了一个可以上传到 playstore 的应用程序。我已经创建了 Keystore 密码,并且在构建 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

构建.gradle(应用程序)

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

2 回答 2

1

您有minifyEnabled truefor release 并且可能需要一些需要的类 for javax.annotation.Nullable,但通过缩小被删除。如果您现在不需要它,您可以删除该标签以进行发布。如果您确实需要该标志,则必须修改并配置 minify 以保留该类。

于 2017-12-11T13:33:35.273 回答
0

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

于 2017-12-11T14:11:37.823 回答