Redex: Unexpected field type with Kotlin

Created on 1 May 2016  路  13Comments  路  Source: facebook/redex

Trying out latest redex on an app written in Kotlin, I get this:

opt/final_inline/FinalInline.cpp:205: bool validate_sget(DexMethod *, DexOpcodeField *): assertion `false' failed.
Unexpected field type in inline_*sget sput private static final int adeln.mediator.Constants.DB_VERSION v0 for field private static final int adeln.mediator.Constants.DB_VERSION value 1 in method private adeln.mediator.Constants.<init>()V

0   redex-all                           0x000000010dd17104 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff8a14c52a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   libsystem_c.dylib                   0x00007fff9ac656e7 abort + 129
4   redex-all                           0x000000010dd170c1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x000000010dd885d9 _ZL13validate_sgetP9DexMethodP14DexOpcodeField + 393
6   redex-all                           0x000000010dd882b9 _Z17inline_cheap_sgetP9DexMethodP14DexOpcodeField + 25
7   redex-all                           0x000000010dd891d5 _Z19inline_field_valuesRNSt3__16vectorIP8DexClassNS_9allocatorIS2_EEEE + 1733
8   redex-all                           0x000000010dd89632 _ZN15FinalInlinePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 66
9   redex-all                           0x000000010dd3613a _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 378
10  redex-all                           0x000000010dd08dc7 main + 2263
11  libdyld.dylib                       0x00007fff8a0fe5ad start + 1
12  ???                                 0x0000000000000006 0x0 + 6
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 788, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 744, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 115, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 584, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/usr/local/bin/redex-all --apkdir /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmp2hy04v26.redex_extracted_apk --outdir /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmpf3p32rdw.redex_dexen /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmpf3p32rdw.redex_dexen/dex0/classes.dex' returned non-zero exit status -6
bug

Most helpful comment

Interesting -- there are some field types that redex won't try to optimize away (longs and doubles for sure, maybe other things I'm forgetting), but we should filter them out before it gets to that point. I'll investigate. Thanks for raising this.

All 13 comments

huh, is it trying to inline a getter method generated for a constant?

I have this object, and somehow it's ok with every constant except DB_VERSION

object Constants {
  val BASE_URL = HttpUrl.parse("https://api.vk.com/method/")!!
  val VK_API_VERSION = "5.50"
  val VK_SCOPE = VKScopes.MESSAGES

  val VK_CHAT_MASK = 2000000000L
  val MAX_RANDOM_ID = 1000000000

  val DB_NAME = "mediator.sqlite"
  val DB_VERSION = 1

  val LONG_POLL_WAIT_SECONDS = 25L
  val TYPING_DELAY_SECS = 5L
  val MAIN_ANIM_DUR = 250L
  val BOTTOM_REACH = 30
}

another error:

opt/final_inline/FinalInline.cpp:205: bool validate_sget(DexMethod *, DexOpcodeField *): assertion `false' failed.
Unexpected field type in inline_*sget sput-boolean public static final boolean kotlin._Assertions.ENABLED
  annotations:type:Lkotlin/jvm/JvmField; visibility:build annotations: v0 for field public static final boolean kotlin._Assertions.ENABLED
  annotations:type:Lkotlin/jvm/JvmField; visibility:build annotations: value ('nullptr') in method private kotlin._Assertions.<init>()V

0   redex-all                           0x000000010ad38104 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff8a14c52a _sigtramp + 26
2   libsystem_malloc.dylib              0x00007fff969efdcc szone_free_definite_size + 2638
3   libsystem_c.dylib                   0x00007fff9ac656e7 abort + 129
4   redex-all                           0x000000010ad380c1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x000000010ada95d9 _ZL13validate_sgetP9DexMethodP14DexOpcodeField + 393
6   redex-all                           0x000000010ada92b9 _Z17inline_cheap_sgetP9DexMethodP14DexOpcodeField + 25
7   redex-all                           0x000000010adaa1d5 _Z19inline_field_valuesRNSt3__16vectorIP8DexClassNS_9allocatorIS2_EEEE + 1733
8   redex-all                           0x000000010adaa632 _ZN15FinalInlinePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 66
9   redex-all                           0x000000010ad5713a _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 378
10  redex-all                           0x000000010ad29dc7 main + 2263
11  libdyld.dylib                       0x00007fff8a0fe5ad start + 1
12  ???                                 0x0000000000000006 0x0 + 6
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 788, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 744, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 115, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 584, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '/usr/local/bin/redex-all --apkdir /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmpnkrz_ev_.redex_extracted_apk --outdir /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmp3za3con6.redex_dexen /var/folders/21/4wlt1pmj2wq7rp1tn92x3mlc0000gn/T/tmp3za3con6.redex_dexen/dex0/classes.dex' returned non-zero exit status -6

Interesting -- there are some field types that redex won't try to optimize away (longs and doubles for sure, maybe other things I'm forgetting), but we should filter them out before it gets to that point. I'll investigate. Thanks for raising this.

I am having a similar problem when redexing my project with Kotlin. Here is my stack trace:

opt/final_inline/FinalInline.cpp:208: bool validate_sget(DexMethod *, DexOpcodeField *): assertion 
false' failed.
Unexpected field type in inline_*sget sput-wide private static final double kotlin.jvm.internal.DoubleCompanionObject.MIN_VALUE v0 for field private static final double kotlin.jvm.internal.DoubleCompanionObject.MIN_VALUE value 1 in method private kotlin.jvm.internal.DoubleCompanionObject.<init>()V

0   redex-all                           0x00000001018b1d24 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff9421652a _sigtramp + 26
2   ???                                 0x0000000000000000 0x0 + 0
3   libsystem_c.dylib                   0x00007fff9e09d6e7 abort + 129
4   redex-all                           0x00000001018b1ce1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x0000000101922016 _ZL13validate_sgetP9DexMethodP14DexOpcodeField + 390
6   redex-all                           0x0000000101921cf9 _Z17inline_cheap_sgetP9DexMethodP14DexOpcodeField + 25
7   redex-all                           0x0000000101922c15 _Z19inline_field_valuesRNSt3__16vectorIP8DexClassNS_9allocatorIS2_EEEE + 1733
8   redex-all                           0x0000000101923070 _ZN15FinalInlinePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 64
9   redex-all                           0x00000001018d10ea _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 378
10  redex-all                           0x00000001018a3d77 main + 2263
11  libdyld.dylib                       0x00007fff979035ad start + 1
Traceback (most recent call last):
  File "./redex", line 788, in <module>
    run_redex(args)
  File "./redex", line 744, in run_redex
    dexen)
  File "./redex", line 115, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 584, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command './redex-all --apkdir /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmpu8vur2fl.redex_extracted_apk --outdir /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex0/classes.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex1/classes2.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex2/classes3.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex3/classes4.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex4/classes5.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex5/classes6.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex6/classes7.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex7/classes8.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex8/classes9.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex9/classes10.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex10/classes11.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex11/classes12.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex12/classes13.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex13/classes14.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex14/classes15.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex15/classes16.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex16/classes17.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex17/classes18.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex18/classes19.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex19/classes20.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex20/classes21.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex21/classes22.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex22/classes23.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex23/classes24.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex24/classes25.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex25/classes26.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex26/classes27.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex27/classes28.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex28/classes29.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex29/classes30.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex30/classes31.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex31/classes32.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex32/classes33.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex33/classes34.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex34/classes35.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex35/classes36.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex36/classes37.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex37/classes38.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex38/classes39.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex39/classes40.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex40/classes41.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex41/classes42.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex42/classes43.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex43/classes44.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex44/classes45.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex45/classes46.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex46/classes47.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex47/classes48.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex48/classes49.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex49/classes50.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex50/classes51.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex51/classes52.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex52/classes53.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex53/classes54.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex54/classes55.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex55/classes56.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex56/classes57.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex57/classes58.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex58/classes59.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex59/classes60.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex60/classes61.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex61/classes62.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex62/classes63.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex63/classes64.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex64/classes65.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex65/classes66.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex66/classes67.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex67/classes68.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex68/classes69.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmppu946cts.redex_dexen/dex69/classes70.dex' returned non-zero exit status -6

I forgot to mention that redexing my kotlin project goes perfectly after a proguard pass

After a proguard pass I'm getting this error now:

opt/final_inline/FinalInline.cpp:208: bool validate_sget(DexMethod *, DexOpcodeField *): assertion `false' failed.
Unexpected field type in inline_*sget sput-boolean public static final boolean kotlin._Assertions.ENABLED
  annotations:type:Lkotlin/jvm/JvmField; visibility:build annotations: v0 for field public static final boolean kotlin._Assertions.ENABLED
  annotations:type:Lkotlin/jvm/JvmField; visibility:build annotations: value ('nullptr') in method private kotlin._Assertions.<init>()V

0   redex-all                           0x000000010a618d24 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff9421652a _sigtramp + 26
2   libsystem_malloc.dylib              0x00007fff949bfdcc szone_free_definite_size + 2638
3   libsystem_c.dylib                   0x00007fff9e09d6e7 abort + 129
4   redex-all                           0x000000010a618ce1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x000000010a689016 _ZL13validate_sgetP9DexMethodP14DexOpcodeField + 390
6   redex-all                           0x000000010a688cf9 _Z17inline_cheap_sgetP9DexMethodP14DexOpcodeField + 25
7   redex-all                           0x000000010a689c15 _Z19inline_field_valuesRNSt3__16vectorIP8DexClassNS_9allocatorIS2_EEEE + 1733
8   redex-all                           0x000000010a68a070 _ZN15FinalInlinePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 64
9   redex-all                           0x000000010a6380ea _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER11ConfigFiles + 378
10  redex-all                           0x000000010a60ad77 main + 2263
11  libdyld.dylib                       0x00007fff979035ad start + 1
Traceback (most recent call last):
  File "./redex", line 788, in <module>
    run_redex(args)
  File "./redex", line 744, in run_redex
    dexen)
  File "./redex", line 115, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/subprocess.py", line 584, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command './redex-all --apkdir /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmp95ay3ujg.redex_extracted_apk --outdir /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmp68geualo.redex_dexen /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmp68geualo.redex_dexen/dex0/classes.dex /var/folders/hp/0033ls7n1_zg72twy3j5wlcm0000gq/T/tmp68geualo.redex_dexen/dex1/classes2.dex' returned non-zero exit status -6

@denis-trailin-hs weird, that's what I was getting before the proguard

what's your proguard config?

Here is my proguard config. I've redacted and removed some sensitive information but this is the core of it.

-optimizationpasses 5

#When not preverifing in a case-insensitive filing system, such as Windows. Because this tool unpacks your processed jars, you should then use:
-dontusemixedcaseclassnames

#Specifies not to ignore non-public library classes. As of version 4.5, this is the default setting
-dontskipnonpubliclibraryclasses

#Preverification is irrelevant for the dex compiler and the Dalvik VM, so we can switch it off with the -dontpreverify option.
-dontpreverify

#Specifies to write out some more information during processing. If the program terminates with an exception, this option will print out the entire stack trace, instead of just the exception message.
-verbose

#The -optimizations option disables some arithmetic simplifications that Dalvik 1.0 and 1.5 can't handle. Note that the Dalvik VM also can't handle aggressive overloading (of static fields).
#To understand or change this check http://proguard.sourceforge.net/index.html#/manual/optimizations.html
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*

#To repackage classes on a single package
#-repackageclasses ''

#Keep classes that are referenced on the AndroidManifest
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class com.android.vending.licensing.ILicensingService


#To remove debug logs:
-assumenosideeffects class android.util.Log {
    public static *** d(...);
    public static *** v(...);
    public static *** w(...);
    public static *** e(...);
}

#To avoid changing names of methods invoked on layout's onClick.
# Uncomment and add specific method names if using onClick on layouts
#-keepclassmembers class * {
# public void onClickButton(android.view.View);
#}

#Maintain java native methods
-keepclasseswithmembernames class * {
    native <methods>;
}

#To maintain custom components names that are used on layouts XML.
#Uncomment if having any problem with the approach below
#-keep public class custom.components.package.and.name.**

#To maintain custom components names that are used on layouts XML:
-keep public class * extends android.view.View {
    public <init>(android.content.Context);
    public <init>(android.content.Context, android.util.AttributeSet);
    public <init>(android.content.Context, android.util.AttributeSet, int);
    public void set*(...);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet);
}

-keepclasseswithmembers class * {
    public <init>(android.content.Context, android.util.AttributeSet, int);
}

#Maintain enums
-keepclassmembers enum * {
    public static **[] values();
    public static ** valueOf(java.lang.String);
}

#To keep parcelable classes (to serialize - deserialize objects to sent through Intents)
-keepnames class * implements android.os.Parcelable {
    public static final ** CREATOR;
}

#Keep the R
-keepclassmembers class **.R$* {
    public static <fields>;
}

###### ADDITIONAL OPTIONS NOT USED NORMALLY

#To keep callback calls. Uncomment if using any
#http://proguard.sourceforge.net/index.html#/manual/examples.html#callback
#-keep class mypackage.MyCallbackClass {
#   void myCallbackMethod(java.lang.String);
#}

#Uncomment if using Serializable
-keepclassmembers class * implements java.io.Serializable {
    private static final java.io.ObjectStreamField[] serialPersistentFields;
    private void writeObject(java.io.ObjectOutputStream);
    private void readObject(java.io.ObjectInputStream);
    java.lang.Object writeReplace();
    java.lang.Object readResolve();
}

# 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.**

# OkHTTP
-keep class com.squareup.okhttp.** { *; }
-dontwarn com.squareup.okhttp.**
-keep class org.apache.http.** { *; }
-dontwarn org.apache.http.**

# Required for Butterknife
-dontwarn butterknife.internal.**
-keep class **$$ViewInjector { *; }
-keepnames class * { @butterknife.InjectView *;}

# ABS pullToRefresh
-dontwarn com.actionbarsherlock.**

# Scribe
-keep class org.apache.commons.** { *; }
-dontwarn ru.hh.oauth.subscribe.**
-dontwarn javax.xml.bind.DatatypeConverter

# Required for Facebook SDK
-keep class com.facebook.** { *; }
-keepattributes Signature

# Required if you ARE using IAP:
-keep class com.android.vending.billing.**

# ABS
-keep class com.actionbarsherlock.** {*;}

################################################################################

# Required for attribution
-keep class com.google.android.gms.ads.** { *; }

# Required for Google Play Services (see http://developer.android.com/google/play-services/setup.html)
-keep class * extends java.util.ListResourceBundle {
    protected Object[][] getContents();
}
-keep class com.google.android.gms.gcm.**{ *; }

-keep public class com.google.android.gms.common.internal.safeparcel.SafeParcelable {
    public static final *** NULL;
}

-keepnames @com.google.android.gms.common.annotation.KeepName class *
-keepclassmembernames class * {
    @com.google.android.gms.common.annotation.KeepName *;
}
################################################################################

# Any file used in Gson requests can't be obfuscated
-keep class redacted.** {*;}
-keep class redacted.** {*;}
-keep class com.google.gson.** {*;}

#dagger
-keepclasseswithmembernames class * {
  @javax.inject.* <fields>;
  @javax.inject.* <init>(...);
}

-keep @interface dagger.*,javax.inject.*

-keep @dagger.Module class *

-keepclassmembers class * {
  @javax.inject.* <fields>;
}

-keep class **$$ModuleAdapter
-keep class **$$InjectAdapter
-keep class **$$StaticInjection
-keep class dagger.internal.** { *; }
-dontwarn dagger.internal.**
-dontwarn rx.**
-dontwarn org.codehaus.mojo.animal_sniffer.**
-dontwarn java.nio.file.Files
-dontwarn java.nio.file.Path
-dontwarn java.nio.file.OpenOption

# only obfuscate keys
-keep class !redacted { *; }

# Allow obfuscation of android.support.v7.internal.view.menu.**
# to avoid problem on Samsung 4.2.2 devices with appcompat v21
# see https://code.google.com/p/android/issues/detail?id=78377
-keep class !android.support.v7.internal.view.menu.**,android.support.** {*;}

# Retrolambda
-dontwarn java.lang.invoke.*

# Retrofit 
-dontwarn com.google.appengine.api.urlfetch.*
-keep class retrofit.** { *; }
-keepattributes *Annotation*,Signature

-dontwarn org.simpleframework.**

Hmm, I don't see any kotlin in your proguard file. At this point I don't know how I can help

@adelnizamutdinov Nothing much. I'm just hoping this information will help @bertmaher solve the problem.

I get a similar crash with Kotlin, regardless of if it's proguarded the App still doesn't redex:

libredex/Transform.cpp:238: MethodItemEntry *(anonymous namespace)::get_target(MethodItemEntry *, addr_mei_t &): assertion `addr_to_mei.count(target) != 0' failed.
Invalid opcode target 00000044[0x7f9f18c7b230](00000019) 0000005d in get_target if-eqz v6

0   redex-all                           0x000000010e055d24 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff86df252a _sigtramp + 26
2   ???                                 0x6c69616620273020 0x0 + 7811882119904833568
3   libsystem_c.dylib                   0x00007fff8b8f56df abort + 129
4   redex-all                           0x000000010e055ce1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x000000010e0c50a6 _ZN15MethodTransform7balloonEP9DexMethod + 2502
6   redex-all                           0x000000010e0c4648 _ZN15MethodTransform20get_method_transformEP9DexMethodbb + 248
7   redex-all                           0x000000010e036f27 _Z16replace_wrappersP9DexMethodR7DexCodeR14WrapperMethods + 4343
8   redex-all                           0x000000010e037c54 _Z9transformRKNSt3__16vectorIP8DexClassNS_9allocatorIS2_EEEER14WrapperMethodsRK11SynthConfig + 372
9   redex-all                           0x000000010e038487 _ZN9SynthPass8run_passERNSt3__16vectorI8DexStoreNS0_9allocatorIS2_EEEER11ConfigFilesR11PassManager + 135
10  redex-all                           0x000000010e07d074 _ZN11PassManager10run_passesERNSt3__16vectorI8DexStoreNS0_9allocatorIS2_EEEER11ConfigFiles + 1364
11  redex-all                           0x000000010e048b53 main + 5187
12  libdyld.dylib                       0x00007fff829b15ad start + 1
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 501, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 449, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 109, in run_pass
    subprocess.check_call(args)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)

Does this still occur on the most recent version of redex?

Unfortunately I can't try it, was using it on a project I'm no longer on. If I use it again with Kotlin, I'll update you.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lukef picture lukef  路  3Comments

coolegos picture coolegos  路  4Comments

awelc picture awelc  路  3Comments

gydeveloper picture gydeveloper  路  5Comments

MaTriXy picture MaTriXy  路  7Comments