android java.lang.AssertionError: java.lang.NoSuchMethodException - Proguard

Narendra Singh

I am getting my app crashed with this error, in the released version of app. Its working fine in debug mode

Process: com.app, PID: 13162
        java.lang.AssertionError: java.lang.NoSuchMethodException: <init> [interface twitter4j.conf.Configuration, interface twitter4j.a.b]
                at twitter4j.n.<clinit>(Unknown Source)
                at com.app.activities.RegistrationActivity.g(Unknown Source)
                at com.app.activities.RegistrationActivity.onCreate(Unknown Source)
                at android.app.Activity.performCreate(Activity.java:6289)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
                at android.app.ActivityThread.access$900(ActivityThread.java:177)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:145)
                at android.app.ActivityThread.main(ActivityThread.java:5942)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
         Caused by: java.lang.NoSuchMethodException: <init> [interface twitter4j.conf.Configuration, interface twitter4j.a.b]
                at java.lang.Class.getConstructor(Class.java:531)
                at java.lang.Class.getDeclaredConstructor(Class.java:510)
                at twitter4j.n.<clinit>(Unknown Source)
                at com.app.activities.RegistrationActivity.g(Unknown Source)
                at com.app.activities.RegistrationActivity.onCreate(Unknown Source)
                at android.app.Activity.performCreate(Activity.java:6289)
                at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
                at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
                at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2758)
                at android.app.ActivityThread.access$900(ActivityThread.java:177)
                at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1448)
                at android.os.Handler.dispatchMessage(Handler.java:102)
                at android.os.Looper.loop(Looper.java:145)
                at android.app.ActivityThread.main(ActivityThread.java:5942)
                at java.lang.reflect.Method.invoke(Native Method)
                at java.lang.reflect.Method.invoke(Method.java:372)
                at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
                at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

The error seems to be generated because of proguard file

Here is the proguard-rules.pro as follows -

# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/adisoft2/android/android-sdk-linux/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
#   http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
#   public *;
#}
#-injars      bin/classes
#-injars      libs
#-outjars     bin/classes-processed.jar
#-libraryjars /usr/local/java/android-sdk/platforms/android-9/android.jar
-keep class twitter4j.conf.**
-keep class twitter4j.TwitterImpl
-keep class twitter4j.conf.PropertyConfigurationFactory
-dontwarn com.squareup.okhttp.**
-dontwarn com.google.appengine.api.urlfetch.**
-dontwarn rx.**
-dontwarn retrofit.**
-keepattributes Signature
-keepattributes *Annotation*
-keep class com.squareup.okhttp.** { *; }
-keep interface com.squareup.okhttp.** { *; }
-keep class retrofit.** { *; }
-keepclasseswithmembers class * {
    @retrofit.http.* <methods>;
}
-dontwarn twitter4j.**
-dontwarn com.google.android.gms.**
-dontwarn okio.**


# This is a configuration file for ProGuard.
# http://proguard.sourceforge.net/index.html#manual/usage.html
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-verbose
# Optimization is turned off by default. Dex does not like code run
# through the ProGuard optimize and preverify steps (and performs some
# of these optimizations on its own).
-dontoptimize
-dontpreverify
# Note that if you want to enable optimization, you cannot just
# include optimization flags in your own project configuration file;
# instead you will need to point to the
# "proguard-android-optimize.txt" file instead of this one from your
# project.properties file.
-keepattributes *Annotation*
-keep public class com.google.vending.licensing.ILicensingService
-keep public class com.android.vending.licensing.ILicensingService
# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native
-keepclasseswithmembernames class * {
    native <methods>;
}
# keep setters in Views so that animations can still work.
# see http://proguard.sourceforge.net/manual/examples.html#beans
-keepclassmembers public class * extends android.view.View {
   void set*(***);
   *** get*();
}
# We want to keep methods in Activity that could be used in the XML attribute onClick
-keepclassmembers class * extends android.app.Activity {
   public void *(android.view.View);
}
# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements android.os.Parcelable {
  public static final android.os.Parcelable$Creator CREATOR;
}
-keepclassmembers class **.R$* {
    public static <fields>;
}
# The support library contains references to newer platform versions.
# Don't warn about those in case this app is linking against an older
# platform version.  We know about them, and they are safe.
-dontwarn android.support.**

Please let me know, what am I doing wrong, and how to fix.

Narendra Singh

Adding this in proguard-rules.pro worked for me.

-keep class twitter4j.** { *; }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

ProGuard java.lang.NoSuchMethodException

From Dev

Java - java.lang.NoSuchMethodException

From Dev

Android Mockito java.lang.AssertionError:

From Java

java.lang.NoSuchMethodException for onCreate

From Dev

java.lang.NoSuchMethodException for onCreate

From Dev

java.lang.RuntimeException: java.lang.NoSuchMethodException: Hadoop mapreduce

From Dev

java.lang.RuntimeException: java.lang.NoSuchMethodException: Hadoop mapreduce

From Dev

Proguard warning with [java/lang/String]

From Dev

java.lang.NoSuchMethodException: setHomeActionContentDescription [int]?

From Dev

java.lang.NoSuchMethodException: Unknown property

From Dev

Kafka throws java.lang.NoSuchMethodException

From Dev

getDeclaredMethod leading to java.lang.NoSuchMethodException

From Dev

A java.lang.NoSuchMethodException error (layouts)

From Dev

A java.lang.NoSuchMethodException error (layouts)

From Dev

java.lang.NoSuchMethodException struts servlet

From Dev

java.lang.NoSuchMethodException: AffirmativeBased.<init>()

From Dev

Selenium(Java), java.lang.AssertionError

From Dev

Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum

From Dev

What causing this exception java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]

From Dev

Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]

From Dev

java.lang.AssertionError: java.lang.AssertionError: Expected :lastName is required Actual :loginName is required

From Dev

ProGuard obfuscation - java.lang.NoSuchMethodError: getPointer

From Dev

Why Scala needs duplicate constructor? (java.lang.NoSuchMethodException)

From Dev

No default constructor found; nested exception is java.lang.NoSuchMethodException

From Dev

Struts Hibernate Integration with Annotations (java.lang.NoSuchMethodException)

From Dev

java.lang.NoSuchMethodException: Bean has no property named

From Dev

java.lang.NoSuchMethodException: akka.cluster.ClusterActorRefProvider

From Dev

Why Scala needs duplicate constructor? (java.lang.NoSuchMethodException)

From Dev

Error: java.lang.NoSuchMethodException: java.lang.Long.<init>() in spring MVC

Related Related

  1. 1

    ProGuard java.lang.NoSuchMethodException

  2. 2

    Java - java.lang.NoSuchMethodException

  3. 3

    Android Mockito java.lang.AssertionError:

  4. 4

    java.lang.NoSuchMethodException for onCreate

  5. 5

    java.lang.NoSuchMethodException for onCreate

  6. 6

    java.lang.RuntimeException: java.lang.NoSuchMethodException: Hadoop mapreduce

  7. 7

    java.lang.RuntimeException: java.lang.NoSuchMethodException: Hadoop mapreduce

  8. 8

    Proguard warning with [java/lang/String]

  9. 9

    java.lang.NoSuchMethodException: setHomeActionContentDescription [int]?

  10. 10

    java.lang.NoSuchMethodException: Unknown property

  11. 11

    Kafka throws java.lang.NoSuchMethodException

  12. 12

    getDeclaredMethod leading to java.lang.NoSuchMethodException

  13. 13

    A java.lang.NoSuchMethodException error (layouts)

  14. 14

    A java.lang.NoSuchMethodException error (layouts)

  15. 15

    java.lang.NoSuchMethodException struts servlet

  16. 16

    java.lang.NoSuchMethodException: AffirmativeBased.<init>()

  17. 17

    Selenium(Java), java.lang.AssertionError

  18. 18

    Android release APK crash with java.lang.AssertionError: impossible in java.lang.Enum

  19. 19

    What causing this exception java.lang.RuntimeException: java.lang.NoSuchMethodException: <init> [class android.view.View]

  20. 20

    Caused by: java.lang.NoSuchMethodException: <init> [class android.content.Context, interface android.util.AttributeSet]

  21. 21

    java.lang.AssertionError: java.lang.AssertionError: Expected :lastName is required Actual :loginName is required

  22. 22

    ProGuard obfuscation - java.lang.NoSuchMethodError: getPointer

  23. 23

    Why Scala needs duplicate constructor? (java.lang.NoSuchMethodException)

  24. 24

    No default constructor found; nested exception is java.lang.NoSuchMethodException

  25. 25

    Struts Hibernate Integration with Annotations (java.lang.NoSuchMethodException)

  26. 26

    java.lang.NoSuchMethodException: Bean has no property named

  27. 27

    java.lang.NoSuchMethodException: akka.cluster.ClusterActorRefProvider

  28. 28

    Why Scala needs duplicate constructor? (java.lang.NoSuchMethodException)

  29. 29

    Error: java.lang.NoSuchMethodException: java.lang.Long.<init>() in spring MVC

HotTag

Archive