IntelliDroid icon indicating copy to clipboard operation
IntelliDroid copied to clipboard

gui: add a script to process ButterKnife annotations

Open zhuowei opened this issue 8 years ago • 0 comments

ButterKnife, a popular UI library used by 4.38% of all apps tracked by AppBrain, specifies UI listeners via method annotations. In particular, the Kickstarter app (popular open-source test case) uses it for all listeners.

Since Dare doesn't preserve annotations, make an external utility that uses dexlib2 to extract annotations into a .json. Currently only ButterKnife.OnClick annotations are extracted.

Note that this is a temporary approach: ButterKnife doesn't use the annotations at runtime, so some apps such as Microsoft Outlook strips the view IDs during build, making the annotations useless. The proper way is to parse the ViewBinder/ViewBinding classes generated by ButterKnife, but that is more difficult.

Another issue: the annotation extractor uses a dexlib2 build from Java 8, but the rest of IntelliDroid needs Java 7. Will rebuild dexlib2 later.

Tested with Kickstarter as the test application and Context.startActivity as the target method: this successfully finds three additional paths.

This depends on #1.

zhuowei avatar Mar 21 '18 04:03 zhuowei