Giter Site home page Giter Site logo

facebook / redex Goto Github PK

View Code? Open in Web Editor NEW
6.0K 225.0 649.0 39.66 MB

A bytecode optimizer for Android apps

Home Page: https://fbredex.com/

License: MIT License

Makefile 0.40% C++ 87.74% M4 0.46% C 0.46% Python 3.73% Shell 0.24% Java 5.05% Perl 0.01% CMake 0.27% Dockerfile 0.01% JavaScript 0.09% CSS 0.02% Assembly 0.01% Kotlin 0.15% Rust 1.37%

redex's Introduction

ReDex: An Android Bytecode Optimizer

ReDex is an Android bytecode (dex) optimizer originally developed at Facebook. It provides a framework for reading, writing, and analyzing .dex files, and a set of optimization passes that use this framework to improve the bytecode. An APK optimized by ReDex should be smaller and faster than its source.

Go to https://fbredex.com for full documentation.

Contributions

See CONTRIBUTING.md to understand how to contribute to this project.

License

The ReDex repository is available under the MIT License.

redex's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

redex's Issues

Unexpected token - on line 11 (while running Redex passing dexguard mapping and config file)

While running Redex on an obfuscated APK (using Dexguard, the paid version of Proguard), the following error appears:

Unexpected token - on line 11
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 779, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 735, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 110, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'redex-all --apkdir /tmp/tmp63oe7fvl.redex_extracted_apk --outdir /tmp/tmpg3lptjgm.redex_dexen --config /tmp/tmpv5tx4yjm/rewritten.config --proguard-config dexguard-config.txt -Sproguard_map=mapping.txt /tmp/tmpg3lptjgm.redex_dexen/dex0/classes.dex' returned non-zero exit status 1

Here's the Redex config file I'm using:

{
"redex" : {
  "passes" : [
    "ReBindRefsPass",
    "BridgePass",
    "FinalInlinePass",
    "DelSuperPass",
    "SingleImplPass",
    "SimpleInlinePass",
    "StaticReloPass",
    "RemoveEmptyClassesPass",
    "ShortenSrcStringsPass"
  ]
}
}

Invoked with:
redex my.apk -c my.config -m mapping.txt -P dexguard-config.txt -o out.apk

UPDATE:
Line 11 of dexguard-config.txt is the first "good" line of the config file (the previous lines are comments or empty lines) and states:
-dalvik

git submodule update --init

when I'm trying to run
git submodule update --init it says "fatal: Not a git repository (or any of the parent directories): .git"

Better error message when ANDROID_SDK isn't set

We look at this environment variable to find zipalign, but if it's not set we just die with a KeyError. It'd be better to either (a) give a helpful error, or (b) just don't zipalign. (a) is probably better.

Problems with libdouble-conversion

I get this error in my config.log (just a excerpt). I don't think it's caused of my system, I have libdouble-conversion proper installed.

configure:5920: $? = 0
configure:5930: result: yes
configure:6050: checking for adler32 in -lz
configure:6075: gcc -o conftest -g -O2   conftest.c -lz   >&5
configure:6075: $? = 0
configure:6084: result: yes
configure:6098: checking for ceil in -ldouble-conversion
configure:6123: gcc -o conftest -g -O2   conftest.c -ldouble-conversion  -lz  >&5
conftest.c:24:6: warning: conflicting types for built-in function 'ceil'
 char ceil ();
      ^
/tmp/ccvfYpKv.o: In function `main':
/home/patrik/redex/conftest.c:28: undefined reference to `ceil'
collect2: error: ld returned 1 exit status
configure:6123: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "redex"
| #define PACKAGE_TARNAME "redex"
| #define PACKAGE_VERSION "1.0"
| #define PACKAGE_STRING "redex 1.0"
| #define PACKAGE_BUGREPORT "[email protected]"
| #define PACKAGE_URL ""
| #define PACKAGE "redex"
| #define VERSION "1.0"
| #define PACKAGE "redex"
| #define VERSION "1.0"
| #define HAVE_BOOST /**/
| #define HAVE_BOOST_FILESYSTEM /**/
| #define HAVE_BOOST_SYSTEM /**/
| #define HAVE_LIBZ 1
| /* end confdefs.h.  */
| 
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char ceil ();
| int
| main ()
| {
| return ceil ();
|   ;
|   return 0;
| }
configure:6132: result: no
configure:6142: error: Please install double-conversion library

Bogus line encountered in proguard map: android.support.multidex.MultiDexApplication: MultiDexApplication()

I got a crash of my app using multidex, is it supported ?

libredex/ProguardMap.cpp:120: void ProguardMap::parse_line(const std::string &): assertion `false' failed.
Bogus line encountered in proguard map: android.support.multidex.MultiDexApplication: MultiDexApplication()

0   redex-all                           0x0000000101528634 _Z15crash_backtracei + 52
1   libsystem_platform.dylib            0x00007fff90b77f1a _sigtramp + 26
2   ???                                 0x00007fff00000001 0x0 + 140733193388033
3   libsystem_c.dylib                   0x00007fff8ac729ab abort + 129
4   redex-all                           0x00000001015285f1 _Z11assert_failPKcS0_jS0_S0_z + 177
5   redex-all                           0x0000000101557f39 _ZN11ProguardMap18parse_proguard_mapINSt3__114basic_ifstreamIcNS1_11char_traitsIcEEEEEEvRT_ + 281
6   redex-all                           0x0000000101556753 _ZN11ProguardMapC2ERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEE + 435
7   redex-all                           0x0000000101553e2b _ZN8PgoFilesC2ERKN5folly7dynamicE + 283
8   redex-all                           0x0000000101550d10 _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEE + 48
9   redex-all                           0x00000001015fda81 main + 2193
10  libdyld.dylib                       0x00007fff8a14d5c9 start + 1
11  ???                                 0x000000000000000a 0x0 + 10

ERROR: ./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t'

I came out with this error:

In file included from portability/Malloc.cpp:17:
./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t'
extern "C" size_t malloc_usable_size(void* ptr);
           ^
1 error generated.
make[4]: *** [portability/Malloc.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
macbookproloreto:redex admin$ 

Reg:
MacOS X 10.10.5
Python 3.5.1

Retrolambda android library probable issue.

Probably redex does not work with Retrolambda:

./redex old.apk -o ~/new.apk
opt/bridge/Bridge.cpp:292: void BridgeRemover::delete_unused_bridgees(): assertion `bridge->is_virtual()' failed.
bridge: private private com.example.ExpandableListAdapter.lambda$onBindViewHolder$129(Lpl/example/android/common/ExpandableListAdapter$Group;Landroid/view/View;)V
bridgee: private private com.example.ExpandableListAdapter.refreshList(Lpl/example/android/common/ExpandableListAdapter$Group;)V
annotations:type:Ldalvik/annotation/Signature; visibility:system annotations:value:( Lpl/example/android/common/ExpandableListAdapter$Group < Lpl/example/android/festival/breweries/FestivalBrewery; Lpl/example/android/festival/breweries/FestivalBeer; >;)V
0 redex-all 0x000000010973ba14 _Z15crash_backtracei + 52
1 libsystem_platform.dylib 0x00007fff9187052a _sigtramp + 26
2 ??? 0x00007fff60e39552 0x0 + 140734818915666
3 libsystem_c.dylib 0x00007fff83c586e7 abort + 129
4 redex-all 0x000000010973b9d1 _Z11assert_failPKcS0_jS0_S0_z + 177
5 redex-all 0x00000001097b3a17 _ZN13BridgeRemover22delete_unused_bridgeesEv + 215
6 redex-all 0x00000001097b36ec _ZN13BridgeRemover3runEv + 92
7 redex-all 0x00000001097b3552 _ZN10BridgePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER8PgoFiles + 114
8 redex-all 0x000000010975d398 _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEE + 312
9 redex-all 0x0000000109804eb8 main + 2168
10 libdyld.dylib 0x00007fff874495ad start + 1
11 ??? 0x0000000000000006 0x0 + 6
Traceback (most recent call last):
File "./redex", line 779, in
run_redex(args)
File "./redex", line 735, in run_redex
dexen)
File "./redex", line 110, 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/fl/x0_3ssc93zvf9kn4d4p2___00000gn/T/tmpoqze1ul4.redex_extracted_apk --outdir /var/folders/fl/x0_3ssc93zvf9kn4d4p2___00000gn/T/tmpenvbqlvi.redex_dexen /var/folders/fl/x0_3ssc93zvf9kn4d4p2___00000gn/T/tmpenvbqlvi.redex_dexen/dex0/classes.dex' returned non-zero exit status -6

openssl/evp.h' file not found

Building command fails
autoreconf -ivf && ./configure && make && make install

Error output is below :

In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:23:
In file included from ./../folly/io/async/AsyncSocketBase.h:19:
In file included from ./../folly/io/async/EventBase.h:43:
In file included from ./../folly/io/async/Request.h:27:
./../folly/SingletonThreadLocal.h:32:21: warning: initialized lambda captures are a C++14 extension
[-Wc++14-extensions]
: singleton_(createFunc = std::move(createFunc) mutable {
^
./../folly/SingletonThreadLocal.h:33:36: warning: initialized lambda captures are a C++14 extension
[-Wc++14-extensions]
return new ThreadLocalT([createFunc =
^
In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:26:
./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h' file not found

include <openssl/evp.h>

     ^

2 warnings and 1 error generated.
make[4]: *** [io/async/AsyncPipe.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

README should require brew install openssl

On OS X El Capitan, following the steps listed in README.md, I get the following error:

./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h' file not found

I have Homebrew's OpenSSL package installed, at version 1.0.2g. I have only ever dabbled in C/C++, so am not sure how to proceed; apologies if there is an obvious fix.

checking for main in -ldouble-conversion... no

on mac 10.11.3
Warning: boost-1.58.0 already installed
Warning: double-conversion-1.1.5 already installed
Warning: gflags-2.1.2 already installed
Warning: glog-0.3.4 already installed
Warning: libevent-2.0.22 already installed

i download double-conversion in /usr/local/Cellar/double-conversion
but can't found it . why?

Installation fails after redex

Trying to install redexed app fails with Failure [INSTALL_PARSE_FAILED_NO_CERTIFICATES]
Tried with both debug & release apk.

compile failed.

                ^

./../folly/SingletonThreadLocal.h:33:36: warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]
return new ThreadLocalT([createFunc =
^
In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:26:
./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h' file not found

include <openssl/evp.h>

     ^

2 warnings and 1 error generated.
make[4]: *** [io/async/AsyncPipe.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

void BridgeRemover::delete_unused_bridgees(): assertion `bridge->is_virtual()' failed.

Crash happens when redexing this APK: https://dirbaio.net/d/verse.apk

We reproduced it on Arch Linux and Mac OSX.

dirbaio@saturn:~/Downloads$ redex verse.apk 
opt/bridge/Bridge.cpp:292: void BridgeRemover::delete_unused_bridgees(): assertion `bridge->is_virtual()' failed.
bridge: private com.verse.presentation.transfer.TransactionConfirmationFragment.e(Ljava/lang/Integer;)V
bridgee: private com.verse.presentation.transfer.TransactionConfirmationFragment.V()V
redex-all[0x414647]
/usr/lib/libc.so.6(+0x33330)[0x7ff6da9ca330]
/usr/lib/libc.so.6(gsignal+0x38)[0x7ff6da9ca2a8]
/usr/lib/libc.so.6(abort+0x16a)[0x7ff6da9cb72a]
redex-all[0x41462a]
redex-all[0x49c98c]
redex-all[0x43fe0b]
redex-all[0x40a81f]
/usr/lib/libc.so.6(__libc_start_main+0xf0)[0x7ff6da9b7710]
redex-all[0x40b929]
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 779, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 735, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 110, in run_pass
    subprocess.check_call(args, shell=True)
  File "/usr/lib/python3.5/subprocess.py", line 584, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'redex-all --apkdir /tmp/tmplddfq0zg.redex_extracted_apk --outdir /tmp/tmp2udvu6p7.redex_dexen /tmp/tmp2udvu6p7.redex_dexen/dex0/classes.dex' returned non-zero exit status -6

Is FB Patent abusive or just unclear ?

The patent file says :

A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent, including a
cross-claim or counterclaim.

There is something logical in the patent file : a protection for FB not being possibly sued for using this stuff. Which seems logical, and I would believe the apache licence or other licences already have provisions for this.

Though, the claim here is broader : it is not possible to sue FB on any patent and this include counter patent assertion. So a logical reading of the patent file is : "if your company has patents, and use redex, and FB violates the company's patent, then the company cannot sue FB because the company uses redex." I believe this reading is not expected, it would probably be abusive as no one can bargain the right to go against the law. The patent assertion is probably missing :

A "Patent Assertion" is any lawsuit or other action alleging direct, indirect,
or contributory infringement or inducement to infringe any patent regarding the Software,
including a cross-claim or counterclaim.

Can this be clarified ?

Document how to use InterDex

InterDex is the feedback-directed class layout pass (perhaps it should have a clearer name as well, but that's a separate issue). We should document:

  1. How to enable InterDexPass
  2. How to gather a trace of app cold start
  3. How to feed that trace into InterDex

redex removes required classes.

App crashes on launch.

java.lang.IllegalAccessError: Illegal class access: 'okhttp3.internal.http.RequestLine' attempting to access 'io.fabric.sdk.android.services.common.ExecutorUtils$1' (declaration of 'okhttp3.internal.http.RequestLine' appears in /data/app/com.packageName-1/base.apk)
    at okhttp3.internal.http.RequestLine.getNamedThreadFactory(streamModelLoader:68)
    at com.crashlytics.android.core.CrashlyticsCore.<init>(transition:42)
    at com.crashlytics.android.core.CrashlyticsCore.<init>(transition:200)
    at com.crashlytics.android.Crashlytics.<init>(treeUri:29)

Decompiling redexed apk does not have io.fabric.sdk.android.services.common.ExecutorUtils.class where as in default one has ExecutorUtils.class

Minimal project to try.

Redex.zip
decompiled-jars.zip

run ./gradlew clean build

Find 2 apks in root dir.

  • app-debug.apk works
  • app-redex-signed.apk fails

Mac build error: error: possibly undefined macro: AC_MSG_ERROR

I get this error while trying to build:

configure.ac:21: error: possibly undefined macro: AC_MSG_ERROR
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.

The internet suggests to install pkg-config, which I did, also installed python3 which the error seems to be about to no avail.

./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t' extern "C" size_t malloc_usable_size(void* ptr);

Using MacOSX:

OS X Yosemite
Version 10.10.5
Xcodebuild tools: Xcode 7.0.1
Build version 7A1001

Step 1:

brew install autoconf automake libtool
brew install boost double-conversion gflags glog libevent

Step 2:

git clone "https://github.com/facebook/redex.git"
cd "redex"

Step 3:

git submodule update --init

Step 4:

autoreconf -ivf && ./configure && make && make install

This needs python3, so you need to do brew install python3.

This step leads to a build failure:

    mv -f $depbase.Tpo $depbase.Plo
libtool: compile:  g++ -DHAVE_CONFIG_H -I./.. -pthread -I/usr/local/include -std=gnu++0x -g -O2 -MT portability/Malloc.lo -MD -MP -MF portability/.deps/Malloc.Tpo -c portability/Malloc.cpp  -fno-common -DPIC -o portability/.libs/Malloc.o
In file included from portability/Malloc.cpp:17:
./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t'
extern "C" size_t malloc_usable_size(void* ptr);
           ^
1 error generated.
make[4]: *** [portability/Malloc.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

This is why a prebuilt lib for MacOSX via Homebrew would be nice: #41.

No such file or directory error on Mac

Hello there,

I'm getting this error after running the redex cl on Mac OS. Any idea what may going wrong?

benoit@local:~/Desktop$ redex eb.apk -o eb-redex.apk
Traceback (most recent call last):
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/shutil.py", line 538, in move
    os.rename(src, real_dst)
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/zl/cb9mqw910m907k5qdbcw65bm0000gn/T/tmpcm288xpk.redex_dexen/classes.dex' -> '/var/folders/zl/cb9mqw910m907k5qdbcw65bm0000gn/T/tmpcjbytfn6.redex_extracted_apk/classes.dex'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/redex", line 779, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 746, in run_redex
    dex_mode.repackage(extracted_apk_dir, dex_dir, have_locators)
  File "/usr/local/bin/redex", line 236, in repackage
    shutil.move(join(dex_dir, 'classes.dex'), extracted_apk_dir)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/shutil.py", line 552, in move
    copy_function(src, real_dst)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/shutil.py", line 251, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/usr/local/Cellar/python3/3.5.1/Frameworks/Python.framework/Versions/3.5/lib/python3.5/shutil.py", line 114, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/zl/cb9mqw910m907k5qdbcw65bm0000gn/T/tmpcm288xpk.redex_dexen/classes.dex'

Thanks

openssl/evp.h' file not found

i install python3.5.1 ,but build error, here is the error log

In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:26:
./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h'
file not found

include <openssl/evp.h>

     ^

2 warnings and 1 error generated.
make[4]: *** [io/async/AsyncPipe.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

how to fix this, thanks

Python 3 is required

Might be good to add to the README otherwise you'll get:

configure: error: Redex requires python3

Assertion `ssms.wrapped.find(callee) == ssms.wrapped.end()' failed.

redex-all: opt/synth/Synth.cpp:558: void replace_wrappers(DexMethod_, DexCode_, WrapperMethods&): Assertion `ssms.wrapped.find(callee) == ssms.wrapped.end()' failed.
redex-all[0x415227]
/lib/x86_64-linux-gnu/libc.so.6(+0x36d40)[0x7fa0c02f5d40]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7fa0c02f5cc9]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7fa0c02f90d8]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fb86)[0x7fa0c02eeb86]
/lib/x86_64-linux-gnu/libc.so.6(+0x2fc32)[0x7fa0c02eec32]
redex-all[0x4f1b49]
redex-all[0x4f1e65]
redex-all[0x4f1f38]
redex-all[0x4f2a08]
redex-all[0x440cc5]
redex-all[0x40add6]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf5)[0x7fa0c02e0ec5]
redex-all[0x40bef7]
Aborted (core dumped)
Traceback (most recent call last):
File "/usr/local/bin/redex", line 779, in
run_redex(args)
File "/usr/local/bin/redex", line 735, in run_redex
dexen)
File "/usr/local/bin/redex", line 110, in run_pass
subprocess.check_call(args, shell=True)
File "/usr/lib/python3.4/subprocess.py", line 561, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'redex-all --apkdir /tmp/tmptomskmc3.redex_extracted_apk --outdir /tmp/tmpwset00_5.redex_dexen /tmp/tmpwset00_5.redex_dexen/dex0/classes.dex /tmp/tmpwset00_5.redex_dexen/dex1/classes2.dex /tmp/tmpwset00_5.redex_dexen/dex2/classes3.dex /tmp/tmpwset00_5.redex_dexen/dex3/classes4.dex /tmp/tmpwset00_5.redex_dexen/dex4/classes5.dex' returned non-zero exit status 134

App crashes on launch after redex compression

I did redex compression on the APK, signed and did zipAlign and installed on the device. The app crashes on launch. The logcat says Caused by: java.lang.NoClassDefFoundError: Class not found using the boot class loader; no stack available

I have multiDexEnabled true. Thank you!

Can't exec "libtoolize": No such file or directory at /usr/local/share/autoconf/Autom4te/FileUtils.pm line 345, <GEN7> line 5.

I keep getting Can't exec "libtoolize": No such file or directory at /usr/local/share/autoconf/Autom4te/FileUtils.pm line 345, <GEN7> line 5.. I'm running this on OSX 10.10.5.

Prerequisite

brew install autoconf automake libtool
brew install boost double-conversion gflags glog libevent

git clone https://github.com/facebook/redex.git && cd redex
git submodule update --init

Make

autoreconf -ivf && ./configure && make && make install

#=>autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force
autoreconf: configure.ac: tracing
autoreconf: configure.ac: adding subdirectory third-party/folly/folly to autoreconf
autoreconf: Entering directory `third-party/folly/folly'
autoreconf: running: aclocal --force -I m4
autoreconf: running: libtoolize --copy --force
Can't exec "libtoolize": No such file or directory at /usr/local/share/autoconf/Autom4te/FileUtils.pm line 345, <GEN7> line 5.
autoreconf: failed to run libtoolize: No such file or directory
autoreconf: libtoolize is needed because this package uses Libtool

install error:warning: initialized lambda captures are a C++14 extension [-Wc++14-extensions]

In file included from ./../folly/io/async/Request.h:27:
./../folly/SingletonThreadLocal.h:32:21: warning: initialized lambda captures
are a C++14 extension [-Wc++14-extensions]
: singleton_(createFunc = std::move(createFunc) mutable {
^
./../folly/SingletonThreadLocal.h:33:36: warning: initialized lambda captures
are a C++14 extension [-Wc++14-extensions]
return new ThreadLocalT([createFunc =
^
In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:26:
./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h'
file not found

include <openssl/evp.h>

     ^

2 warnings and 1 error generated.
make[4]: *** [io/async/AsyncPipe.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Unexpected token ' on line 3

I get this crash:

Unexpected token ' on line 3
Traceback (most recent call last):
  File "/usr/local/bin/redex", line 779, in <module>
    run_redex(args)
  File "/usr/local/bin/redex", line 735, in run_redex
    dexen)
  File "/usr/local/bin/redex", line 110, 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)

When I run this command line:

redex playground/release.apk -m playground/mapping.txt -P playground/proguard-project.txt -o playground/out.apk

Line 3 of the proguard-project.txt is:

-repackageclasses ''

When I comment that line out it works.

Compilation issue

Platform is OSX

./../folly/SingletonThreadLocal.h:33:36: warning: initialized lambda captures are a C++14 extension
[-Wc++14-extensions]
return new ThreadLocalT([createFunc =
^
In file included from io/async/AsyncPipe.cpp:16:
In file included from ./../folly/io/async/AsyncPipe.h:18:
In file included from ./../folly/io/async/AsyncTransport.h:26:
./../folly/io/async/ssl/OpenSSLPtrTypes.h:20:10: fatal error: 'openssl/evp.h' file not found

include <openssl/evp.h>

     ^

2 warnings and 1 error generated.
make[4]: *** [io/async/AsyncPipe.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Possible buffer overflow vulnerability in libredex/PgoFiles.cpp

#47

while (fscanf(fp, "%s", buf + 1) == 1) {
fscanf does not do bound checking on the input values. Although I am yet to analyze how bad (or if it is bad at all) it is, this can be easily replaced by ifstream methods. That will also save one iteration of converting the char buffer to string.

Error: SHA256 mismatch

C02PC5C1FVH5:~ guhaoxin$ brew install boost double-conversion gflags glog libevent
Warning: boost-1.57.0 already installed
==> Installing double-conversion dependency: cmake
==> Downloading http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/cmake-3.2.2.tar.gz
==> Downloading http://www.cmake.org/gitweb?p=cmake.git;a=commitdiff_plain;h=2ec

################################################################## 100.0%

Error: SHA256 mismatch
Expected: 147854010874cd68289e3ca203399d5c149287167bca0b67f9c5677f0ee22eb8
Actual: 86f228a5f05e2c3a69308bdbfc77141019d3077c28f3ca99a99dbe0a3172f1ba
Archive: /Library/Caches/Homebrew/cmake--patch-147854010874cd68289e3ca203399d5c149287167bca0b67f9c5677f0ee22eb8.git;a=commitdiff_plain;h=2ecf168f
To retry an incomplete download, remove the file above.

configure error: Please Install double-conversion library

autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: configure.ac: adding subdirectory third-party/folly/folly to autoreconf
autoreconf: Entering directory `third-party/folly/folly'
autoreconf: running: aclocal --force -I m4
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, `build-aux'.
libtoolize: copying file `build-aux/ltmain.sh'
libtoolize: putting macros in AC_CONFIG_MACRO_DIR, `m4'.
libtoolize: copying file `m4/libtool.m4'
libtoolize: copying file `m4/ltoptions.m4'
libtoolize: copying file `m4/ltsugar.m4'
libtoolize: copying file `m4/ltversion.m4'
libtoolize: copying file `m4/lt~obsolete.m4'
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `third-party/folly/folly'
autoreconf: configure.ac: not using Libtool
configure.ac:6: warning: AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
configure.ac:6: http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_005fINIT_005fAUTOMAKE-invocation
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for ranlib... ranlib
checking dependency style of gcc... (cached) gcc3
checking dependency style of g++... (cached) gcc3
checking for a Python interpreter with version >= 3.0... python3
checking for python3... /usr/bin/python3
checking for python3 version... 3.4
checking for python3 platform... linux
checking for python3 script directory... ${prefix}/lib/python3.4/site-packages
checking for python3 extension module directory... ${exec_prefix}/lib/python3.4/site-packages
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for boostlib >= 1.54.0... yes
checking whether the Boost::Filesystem library is available... yes
checking for exit in -lboost_filesystem... yes
checking whether the Boost::System library is available... yes
checking for exit in -lboost_system... yes
checking for adler32 in -lz... yes
checking for ceil in -ldouble-conversion... no
configure: error: Please install double-conversion library

Followed the readme. All dependencies installed correctly. Ubuntu 14.04.

Crash when i try to redex kotlin apk

opt/bridge/Bridge.cpp:37: DexMethod *(anonymous namespace)::match_pattern(DexMethod *): assertioncode' failed.
Bridge method public abstract kotlin.text.MatchGroupCollection.add(Ljava/lang/Object;)Z' doesn't contain code 0 redex-all 0x0000000100e51fa4 _Z15crash_backtracei + 52 1 libsystem_platform.dylib 0x00007fff9ef9c52a _sigtramp + 26 2 ??? 0x00007fff5edb6860 0x0 + 140734784825440 3 libsystem_c.dylib 0x00007fff8cc116e7 abort + 129 4 redex-all 0x0000000100e51f61 _Z11assert_failPKcS0_jS0_S0_z + 177 5 redex-all 0x0000000100eca51c _ZZN13BridgeRemover12find_bridgesEvENKUlP9DexMethodE_clES1_ + 1052 6 redex-all 0x0000000100eca09c _Z12walk_methodsINSt3__16vectorIP8DexClassNS0_9allocatorIS3_EEEEZN13BridgeRemover12find_bridgesEvEUlP9DexMethodE_EvRKT_T0_ + 140 7 redex-all 0x0000000100ec9c34 _ZN13BridgeRemover3runEv + 20 8 redex-all 0x0000000100ec9ae2 _ZN10BridgePass8run_passERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEER8PgoFiles + 114 9 redex-all 0x0000000100e73928 _ZN11PassManager10run_passesERNSt3__16vectorI10DexClassesNS0_9allocatorIS2_EEEE + 312 10 redex-all 0x0000000100f1cf38 main + 2168 11 libdyld.dylib 0x00007fff8f8b45ad start + 1 Traceback (most recent call last): File "/usr/local/bin/redex", line 779, in <module> run_redex(args) File "/usr/local/bin/redex", line 735, in run_redex dexen) File "/usr/local/bin/redex", line 110, 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/xl/htc7wt_x6px_rdy00h1sff8h0000gn/T/tmpnyoddlkf.redex_extracted_apk --outdir /var/folders/xl/htc7wt_x6px_rdy00h1sff8h0000gn/T/tmpkbg0gar4.redex_dexen /var/folders/xl/htc7wt_x6px_rdy00h1sff8h0000gn/T/tmpkbg0gar4.redex_dexen/dex0/classes.dex /var/folders/xl/htc7wt_x6px_rdy00h1sff8h0000gn/T/tmpkbg0gar4.redex_dexen/dex1/classes2.dex' returned non-zero exit status -6

multidex enabled.
compileSdkVersion 23
buildToolsVersion "23.0.3"
kotlin 1.0.1

Malloc.cpp fails to compile: unknown type name 'size_t'

~ sw_vers
ProductName: Mac OS X
ProductVersion: 10.10.5
BuildVersion: 14F1713

~ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Failure message:
libtool: compile: g++ -DHAVE_CONFIG_H -I./.. -pthread -I/usr/local/include -std=gnu++0x -g -O2 -MT portability/Malloc.lo -MD -MP -MF portability/.deps/Malloc.Tpo -c portability/Malloc.cpp -fno-common -DPIC -o portability/.libs/Malloc.o
In file included from portability/Malloc.cpp:17:
./../folly/portability/Malloc.h:27:12: error: unknown type name 'size_t'
extern "C" size_t malloc_usable_size(void* ptr);
^
1 error generated.
make[4]: *** [portability/Malloc.lo] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all] Error 2
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

double-conversion has installed, but configure error

โžœ redex git:(master) โœ— brew install double-conversion
Warning: double-conversion-1.1.5 already installed
// execute autoreconf -ivf && ./configure && make && make install
...msg...
configure: error: Please install double-conversion

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.