3

我正在使用谷歌翻译 api,当我获得发布版本时,会发出以下警告。我搜索了很多示例,但仍然收到此警告。请任何人给我一个解决错误的解决方案。

在这里,我提到了我的 gradle 文件和警告输出。

我的毕业文件:

  buildTypes {
      release {
          minifyEnabled true
          shrinkResources false
          debuggable false
          proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
     }
  }
   packagingOptions {
      exclude 'META-INF/LICENSE'
      exclude 'META-INF/io.netty.versions.properties'
      exclude 'META-INF/INDEX.LIST'
   }
 }

dependencies {
  implementation fileTree(dir: 'libs', include: ['*.jar'])
  implementation 'com.android.support:appcompat-v7:28.0.0'
  implementation 'com.android.support:design:28.0.0'
  implementation 'com.android.support.constraint:constraint-layout:1.1.3'

  implementation 'com.google.cloud:google-cloud-translate:1.65.0'

// add these dependencies for the speech client
  implementation 'io.grpc:grpc-okhttp:1.12.0'
  implementation 'com.google.cloud:google-cloud-speech:0.53.0-alpha'

  implementation 'com.android.support:cardview-v7:28.0.0'
  implementation 'com.android.support:design:28.0.0'
  implementation 'com.android.support:recyclerview-v7:28.0.0'
}
    repositories {
       mavenCentral()
}

警告 :

          io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAdapter: can't find superclass or interface org.conscrypt.AllocatedBuffer  
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAllocatorAdapter: can't find superclass or interface org.conscrypt.BufferAllocator
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$ServerEngine$1: can't find superclass or interface org.conscrypt.HandshakeListener 
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine$1: can't find superclass or interface org.eclipse.jetty.alpn.ALPN$ClientProvider
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine$1: can't find superclass or interface org.eclipse.jetty.alpn.ALPN$ServerProvider
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$1: can't find superclass or interface org.eclipse.jetty.npn.NextProtoNego$ServerProvider    
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$2: can't find superclass or interface org.eclipse.jetty.npn.NextProtoNego$ClientProvider    
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory: can't find referenced class com.google.appengine.api.memcache.Expiration    
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory$AppEngineDataStore: can't find referenced class com.google.appengine.api.memcache.MemcacheServiceFactory 
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory$AppEngineDataStore: can't find referenced class com.google.appengine.api.datastore.DatastoreServiceFactory   
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory$AppEngineDataStore: can't find referenced class com.google.appengine.api.datastore.Entity    
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory$AppEngineDataStore: can't find referenced class com.google.appengine.api.datastore.Blob  
com.google.api.client.extensions.appengine.datastore.AppEngineDataStoreFactory$Builder: can't find referenced class com.google.appengine.api.memcache.Expiration    
com.google.api.client.extensions.appengine.http.UrlFetchRequest: can't find referenced class com.google.appengine.api.urlfetch.HTTPRequest  
com.google.api.client.extensions.appengine.http.UrlFetchRequest: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader   
com.google.api.client.extensions.appengine.http.UrlFetchResponse: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse    
com.google.api.client.extensions.appengine.http.UrlFetchResponse: can't find referenced class com.google.appengine.api.urlfetch.HTTPHeader  
com.google.api.client.extensions.appengine.http.UrlFetchResponse: can't find referenced class com.google.appengine.api.urlfetch.HTTPResponse    
com.google.api.client.extensions.appengine.http.UrlFetchTransport: can't find referenced class com.google.appengine.api.urlfetch.HTTPMethod 
com.google.api.client.extensions.appengine.http.UrlFetchTransport: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions$Builder   
com.google.api.client.extensions.appengine.http.UrlFetchTransport: can't find referenced class com.google.appengine.api.urlfetch.FetchOptions   
com.google.api.client.googleapis.apache.GoogleApacheHttpTransport: can't find referenced class com.google.api.client.http.apache.ApacheHttpTransport    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibDecoder: can't find referenced class com.jcraft.jzlib.JZlib$WrapperType    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibDecoder: can't find referenced class com.jcraft.jzlib.JZlib    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibDecoder: can't find referenced class com.jcraft.jzlib.Inflater 
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder: can't find referenced class com.jcraft.jzlib.JZlib$WrapperType    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder: can't find referenced class com.jcraft.jzlib.JZlib    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder: can't find referenced class com.jcraft.jzlib.Deflater 
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder: can't find referenced class com.jcraft.jzlib.JZlib    
io.grpc.netty.shaded.io.netty.handler.codec.compression.JZlibEncoder: can't find referenced class com.jcraft.jzlib.Deflater 
io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameDecoder: can't find referenced class net.jpountz.lz4.LZ4Factory 
io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameDecoder: can't find referenced class net.jpountz.xxhash.XXHashFactory   
io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameEncoder: can't find referenced class net.jpountz.lz4.LZ4Factory 
io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameEncoder: can't find referenced class net.jpountz.xxhash.XXHashFactory   
io.grpc.netty.shaded.io.netty.handler.codec.compression.Lz4FrameEncoder: can't find referenced class net.jpountz.xxhash.StreamingXXHash32   
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfDecoder: can't find referenced class com.ning.compress.lzf.util.ChunkDecoderFactory  
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfDecoder: can't find referenced class com.ning.compress.lzf.ChunkDecoder  
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfDecoder: can't find referenced class com.ning.compress.BufferRecycler        
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.lzf.util.ChunkEncoderFactory  
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.lzf.ChunkEncoder  
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.BufferRecycler    
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.lzf.LZFEncoder    
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.BufferRecycler    
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.lzf.ChunkEncoder  
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzfEncoder: can't find referenced class com.ning.compress.BufferRecycler    
io.grpc.netty.shaded.io.netty.handler.codec.compression.LzmaFrameEncoder: can't find referenced class lzma.sdk.lzma.Encoder 
io.grpc.netty.shaded.io.netty.handler.codec.compression.ZlibUtil: can't find referenced class com.jcraft.jzlib.JZlib$WrapperType    
io.grpc.netty.shaded.io.netty.handler.codec.protobuf.ProtobufEncoderNano: can't find referenced class com.google.protobuf.nano.MessageNano  
io.grpc.netty.shaded.io.netty.handler.codec.protobuf.ProtobufEncoderNano: can't find referenced class com.google.protobuf.nano.CodedOutputByteBufferNano
io.grpc.netty.shaded.io.netty.handler.codec.protobuf.ProtobufEncoderNano: can't find referenced class com.google.protobuf.nano.MessageNano  
io.grpc.netty.shaded.io.netty.handler.codec.protobuf.ProtobufEncoderNano: can't find referenced class com.google.protobuf.nano.CodedOutputByteBufferNano
io.grpc.netty.shaded.io.netty.handler.codec.protobuf.ProtobufEncoderNano: can't find referenced class com.google.protobuf.nano.MessageNano  
io.grpc.netty.shaded.io.netty.handler.codec.spdy.SpdyHeaderBlockJZlibEncoder: can't find referenced class com.jcraft.jzlib.JZlib$WrapperType    
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine: can't find referenced class org.conscrypt.Conscrypt   
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAdapter: can't find referenced class org.conscrypt.AllocatedBuffer   
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAllocatorAdapter: can't find referenced class org.conscrypt.BufferAllocator  
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$BufferAllocatorAdapter: can't find referenced class org.conscrypt.AllocatedBuffer  
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$ClientEngine: can't find referenced class org.conscrypt.Conscrypt  
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$ClientEngine$1: can't find referenced class org.conscrypt.HandshakeListener    
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$ServerEngine: can't find referenced class org.conscrypt.Conscrypt  
io.grpc.netty.shaded.io.netty.handler.ssl.ConscryptAlpnSslEngine$ServerEngine$1: can't find referenced class org.conscrypt.HandshakeListener    
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine: can't find referenced class org.eclipse.jetty.alpn.ALPN$Provider 
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine: can't find referenced class org.eclipse.jetty.alpn.ALPN  
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine$1: can't find referenced class org.eclipse.jetty.alpn.ALPN$ClientProvider 
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ClientEngine$1: can't find referenced class org.eclipse.jetty.alpn.ALPN    
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine: can't find referenced class org.eclipse.jetty.alpn.ALPN$Provider 
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine: can't find referenced class org.eclipse.jetty.alpn.ALPN  
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine$1: can't find referenced class org.eclipse.jetty.alpn.ALPN$ServerProvider 
io.grpc.netty.shaded.io.netty.handler.ssl.JettyAlpnSslEngine$ServerEngine$1: can't find referenced class org.eclipse.jetty.alpn.ALPN    
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine: can't find referenced class org.eclipse.jetty.npn.NextProtoNego$Provider   
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine: can't find referenced class org.eclipse.jetty.npn.NextProtoNego    
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$1: can't find referenced class org.eclipse.jetty.npn.NextProtoNego$ServerProvider   
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$1: can't find referenced class org.eclipse.jetty.npn.NextProtoNego  
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$2: can't find referenced class org.eclipse.jetty.npn.NextProtoNego$ClientProvider   
io.grpc.netty.shaded.io.netty.handler.ssl.JettyNpnSslEngine$2: can't find referenced class org.eclipse.jetty.npn.NextProtoNego  
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.asn1.x500.X500Name 
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder    
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.operator.jcajce.JcaContentSignerBuilder    
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.cert.X509v3CertificateBuilder  
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.cert.jcajce.JcaX509CertificateConverter    
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.operator.ContentSigner 
io.grpc.netty.shaded.io.netty.handler.ssl.util.BouncyCastleSelfSignedCertGenerator: can't find referenced class org.bouncycastle.cert.X509CertificateHolder
io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator: can't find referenced class sun.security.x509.X509CertInfo   
io.grpc.netty.shaded.io.netty.handler.ssl.util.OpenJdkSelfSignedCertGenerator: can't find referenced class sun.security.x509.X500Name       
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'java.lang.String getName()' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger   
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'void log(org.apache.logging.log4j.Level,java.lang.String,java.lang.Throwable)' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger    
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'boolean isEnabled(org.apache.logging.log4j.Level)' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger    
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'void log(org.apache.logging.log4j.Level,java.lang.String)' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger    
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'void log(org.apache.logging.log4j.Level,java.lang.String,java.lang.Object)' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger   
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'void log(org.apache.logging.log4j.Level,java.lang.String,java.lang.Object,java.lang.Object)' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger  
io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger: can't find referenced method 'void log(org.apache.logging.log4j.Level,java.lang.String,java.lang.Object[])' in program class io.grpc.netty.shaded.io.netty.util.internal.logging.Log4J2Logger 
io.grpc.netty.shaded.io.netty.util.internal.logging.Slf4JLogger: can't find referenced class org.slf4j.Logger   
io.grpc.okhttp.OkHttpChannelProvider: can't find referenced method 'boolean isAndroid()' in program class io.grpc.okhttp.OkHttpChannelProvider      

请任何人给我这个错误的解决方案,

提前谢谢...

4

1 回答 1

0

将这些添加到您的发布 proguard-rules 文件中。

-keep 类 io.grpc.netty.shaded.io{ *; }

-不要警告 io.grpc.netty.shaded.io.**

-keep 类 android.net.http{ *; }

-不要警告 android.net.http.**

-keep class com.google.common{ *; }

-不要警告 com.google.common.**

-keep class org.apache{ *; }

-不要警告 org.apache.**

-keep class org.joda{ *; }

-不要警告 org.joda。**

于 2019-09-23T07:31:40.983 回答