Redex: The system calls the lifecycle methods of the four main components of android, and I don't think redex should affect or change them.

Created on 31 Mar 2020  ·  4Comments  ·  Source: facebook/redex

This is the wrong stack log:

    java.lang.AbstractMethodError: abstract method "boolean android.content.ContentProvider.onCreate()"
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1901)
        at android.content.ContentProvider.attachInfo(ContentProvider.java:1876)
        at android.app.ActivityThread.installProvider(ActivityThread.java:5340)
        at android.app.ActivityThread.installContentProviders(ActivityThread.java:4894)
        at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4834)
        at android.app.ActivityThread.access$1700(ActivityThread.java:166)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1475)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5628)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:853)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:737)

It can be seen that there is a problem with ContentProvider, I decompiled it and positioned it as com.facebook.FacebookContentProvider
This is the normal onCreate () method

public boolean onCreate() {
        return true;
    }

This is the onCreate () method after executing redex

private static final boolean onCreate() {
        return true;
    }

You can see that the problem lies in private static ,Removing RemoveUnreachablePass from the conf can solve this problem, but I don't think this is the best solution. As the lifecycle method of the four main components of Android for system calls, I don't think redex should affect or change them.

Most helpful comment

Hello,

Based on the command line you have provided, I think the problem comes from a missing path to the android support library jar. Please attach -j /path/to/android.jar. You can find this jar in the Android SDK.

Problem solved, thanks...
This is the new command
redex redex-demo-release.apk -o in.redex2.nosign.apk -c /home/zlrab/software/redex/config/aggressive.config -j /home/zlrab/Android/Sdk/platforms/android-26/android.jar

All 4 comments

Can you share the command-line you are using when invoking Redex? And any relevant configuration and source files?

可以在调用Redex时共享正在使用的命令行吗?还有任何相关的配置和源文件?

hi ,The command executed is:

redex in.apk -o in.redex.apk -c /home/zlrab/software/redex/config/aggressive.config

file
redex-demo.zip

This is aggressive.config located under congfig, I did not modify it:

{
  "redex" : {
    "passes" : [
      "RemoveUnreachablePass",
      "StripDebugInfoPass",
      "AccessMarkingPass",
      "MethodDevirtualizationPass",
      "ReBindRefsPass",
      "BridgePass",
      "ResultPropagationPass", # Run after BridgePass to avoid pattern matching conflicts
      "SynthPass",
      "FinalInlinePass",
      "DelSuperPass",
      "UnreferencedInterfacesPass",
      "SingleImplPass",
      "CommonSubexpressionEliminationPass", # Run once just before MethodInlinePass
      "MethodInlinePass",
      "PeepholePass",
      "ConstantPropagationPass",
      "LocalDcePass",
      "AnnoKillPass",
      "DelInitPass",
      "RemoveUnreachablePass",
      "ReorderInterfacesPass",
      "RemoveEmptyClassesPass",
      "SingleImplPass",
      "InterDexPass",
      "CommonSubexpressionEliminationPass", # Run a second time after all method inlining is done
      "RemoveGotosPass",
      "DedupBlocksPass",
      "UpCodeMotionPass",
      "RegAllocPass",
      "CopyPropagationPass",
      "LocalDcePass",
      "DedupBlocksPass",
      "ReduceGotosPass" # This pass should come at the very end, after all other code transformations that might add gotos
    ]
  },
  "RegAllocPass" : {
    "live_range_splitting": false
  },
  "MethodInlinePass": {
    "throws": true,
    "multiple_callers": true,
    "no_inline_annos" : [
      "Lcom/fasterxml/jackson/databind/annotation/JsonDeserialize;"
    ],
    "black_list": [],
    "caller_black_list": []
  },
  "FinalInlinePass" : {
    "propagate_static_finals": true,
    "replace_encodable_clinits": true,
    "black_list_types" : []
  },
  "AnnoKillPass" : {
    "keep_annos": [
      "Landroid/view/ViewDebug$CapturedViewProperty;",
      "Landroid/view/ViewDebug$ExportedProperty;",
      "Landroid/webkit/JavascriptInterface;",
      "Landroid/widget/RemoteViews$RemoteView;",
      "Lcom/google/android/gms/common/annotation/KeepName;"
    ],
    "kill_annos" : [
      "Lcom/google/inject/BindingAnnotation;"
    ],
    "force_kill_annos" : [
      "Ldalvik/annotation/EnclosingClass;",
      "Ldalvik/annotation/EnclosingMethod;",
      "Ldalvik/annotation/InnerClass;",
      "Ldalvik/annotation/MemberClasses;",
      "Ldalvik/annotation/Throws;"
    ]
  },
  "CopyPropagationPass" : {
    "eliminate_const_literals": false,
    "full_method_analysis": true
  },
  "MethodDevirtualizationPass" : {
    "staticize_vmethods_not_using_this" : true,
    "staticize_dmethods_not_using_this" : true
  },
  "StripDebugInfoPass" : {
    "drop_all_dbg_info" : false,
    "drop_local_variables" : true,
    "drop_line_numbers" : false,
    "drop_src_files" : true,
    "use_whitelist" : false,
    "cls_whitelist" : [],
    "method_whitelist" : [],
    "drop_prologue_end" : true,
    "drop_epilogue_begin" : true,
    "drop_all_dbg_info_if_empty" : true
  },
  "PeepholePass" : {
    "disabled_peepholes": [
      "Replace_PutGet",
      "Replace_PutGetWide",
      "Replace_PutGetObject",
      "Replace_PutGetShort",
      "Replace_PutGetChar",
      "Replace_PutGetByte",
      "Replace_PutGetBoolean"
    ]
  },
  "keep_packages": [
    "Lcom/fasterxml/jackson/",
    "Lcom/google/dexmaker/mockito/"
  ],
  "debug_info_kind": "no_custom_symbolication",
  "method_move_map" : "redex-moved-methods-map.txt",
  "string_sort_mode" : "class_order",
  "bytecode_sort_mode" : "class_order",
  "ir_type_checker": {
    "run_after_each_pass" : false,
    "verify_moves" : false
  }
}

Hello,

Based on the command line you have provided, I think the problem comes from a missing path to the android support library jar. Please attach -j /path/to/android.jar. You can find this jar in the Android SDK.

Hello,

Based on the command line you have provided, I think the problem comes from a missing path to the android support library jar. Please attach -j /path/to/android.jar. You can find this jar in the Android SDK.

Problem solved, thanks...
This is the new command
redex redex-demo-release.apk -o in.redex2.nosign.apk -c /home/zlrab/software/redex/config/aggressive.config -j /home/zlrab/Android/Sdk/platforms/android-26/android.jar

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stephanenicolas picture stephanenicolas  ·  9Comments

maocanmao picture maocanmao  ·  6Comments

MaTriXy picture MaTriXy  ·  7Comments

awelc picture awelc  ·  3Comments

amiton picture amiton  ·  5Comments