错误:无法运行包含Firebase jar的应用

时间:2014-04-01 12:25:14

标签: java android android-studio firebase proguard

Gradle输出:

:app:proguardRelease
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find superclass or interface javax.servlet.ServletContextListener
Warning: com.shaded.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.shaded.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: com.shaded.fasterxml.jackson.databind.ext.DOMSerializer: can't find referenced class org.w3c.dom.bootstrap.DOMImplementationRegistry
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.AvalonLogger: can't find referenced class org.shaded.apache.avalon.framework.logger.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Category
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Priority
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.Log4JLogger: can't find referenced class org.shaded.apache.log4j.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Hierarchy
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Hierarchy
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Hierarchy
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.LogKitLogger: can't find referenced class org.shaded.apache.log.Logger
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextListener
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: org.shaded.apache.commons.logging.impl.ServletContextCleaner: can't find referenced class javax.servlet.ServletContextEvent
Warning: there were 73 unresolved references to classes or interfaces.
    You may need to add missing library jars or update their versions.
    If your code works fine without the missing classes, you can suppress
    the warnings with '-dontwarn' options.
    (http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedclass)
:app:proguardRelease FAILED

FAILURE: Build failed with an exception.

* What went wrong:

Execution failed for task ':app:proguardRelease'.
> java.io.IOException: Please correct the above warnings first.

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 5.727 secs

在设备上运行时,点击应用中的聊天标签时,应用会崩溃。

E/AndroidRuntime﹕ FATAL EXCEPTION: main
    java.lang.NoSuchFieldError: PUBLIC_ONLY
            at java.lang.Class.getDeclaredAnnotation(Native Method)
            at java.lang.Class.getAnnotation(Class.java:243)
            at com.d.a.a.c.f.ae.<clinit>(Unknown Source)
            at com.d.a.a.c.z.<clinit>(Unknown Source)
            at com.a.a.e.<clinit>(Unknown Source)
            at com.woodpeck3r.janasena.app.Views.c.a(Unknown Source)
            at android.support.v4.app.Fragment.b(Unknown Source)
            at android.support.v4.app.r.a(Unknown Source)
            at android.support.v4.app.r.a(Unknown Source)
            at android.support.v4.app.d.run(Unknown Source)
            at android.support.v4.app.r.e(Unknown Source)
            at android.support.v4.app.r.b(Unknown Source)
            at android.support.v4.app.v.b(Unknown Source)
            at android.support.v4.view.ViewPager.a(Unknown Source)
            at android.support.v4.view.ViewPager.c(Unknown Source)
            at android.support.v4.view.bs.run(Unknown Source)
            at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
            at android.view.Choreographer.doCallbacks(Choreographer.java:591)
            at android.view.Choreographer.doFrame(Choreographer.java:560)
            at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
            at android.os.Handler.handleCallback(Handler.java:730)
            at android.os.Handler.dispatchMessage(Handler.java:92)
            at android.os.Looper.loop(Looper.java:176)
            at android.app.ActivityThread.main(ActivityThread.java:5419)
            at java.lang.reflect.Method.invokeNative(Native Method)
            at java.lang.reflect.Method.invoke(Method.java:525)
            at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
            at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
            at dalvik.system.NativeStart.main(Native Method)

3 个答案:

答案 0 :(得分:1)

我找到了解决方案: 在project.properties中,添加:

-dontwarn com.shaded.fasterxml.**
-dontwarn org.apache.**
-dontwarn org.shaded.apache.**
-keepnames class com.shaded.fasterxml.jackson.** { *; }
-keepnames class org.shaded.apache.**

这对我有用

答案 1 :(得分:1)

尝试添加到&#39; proguard.cfg&#39;:

-injars bin/classes
-injars libs
-keep class android.support.v4.** { *; }
-keep class ____insert_your_package_lib_inside_jar_file.** { *; }

答案 2 :(得分:1)

看起来你还包含了一些依赖于Java Servlets的库:

  

找不到超类或接口javax.servlet.ServletContextListener

如果是这样的话,你将无法在Android下编译它,因为需要附加Servlet并正确使用它 - 我不确定它是否可行。

Android使用不同的字节码标准,它依赖于Dalvik VM而不是Sun的JVM ......