cuplv / droidel

Framework model for static analysis of Android
Apache License 2.0
45 stars 14 forks source link

cannot run compile_stubs.sh #12

Closed highwater closed 9 years ago

highwater commented 9 years ago

Hi Sam,

compile_stubs.sh keeps giving me error: cannot find symbol with Android jar 4.2.2 or with other jars as well. Here's snippet of the messages:

./src/android/app/ActivityThread.java:2363: error: cannot find symbol
        r.activity.onTranslucentConversionComplete(drawComplete);
                  ^
symbol:   method onTranslucentConversionComplete(boolean)
location: variable activity of type Activity
sblackshear commented 9 years ago

Hi Coraline, Are you using the copy of the JAR linked from the README? I haven't tried it with any other JARs, but that one should work.

There are inevitably going to be compilation problems with different versions of the Android library, since the stubs I have written copy source code from a particular version of Android. The only way to solve this is to manually fix the compiler errors for the JAR you want to work or (even better) contribute new stubs for the version you want to work!

highwater commented 9 years ago

Yes I'm using that exact same Jar. Here's the screengrab (I rename the jar to be android.jar)

screenshot from 2014-12-13 21 50 39

highwater commented 9 years ago

ArrayMap is added in API 19, and here's the classes from stubs directory, there is no ArrayMap.

screenshot from 2014-12-13 22 21 22

sblackshear commented 9 years ago

Hmm, I'm a bit puzzled since this works both on my machine and on the Travis build. Try using this exact sequence of actions (from the stubs directory)

wget http://repository.grepcode.com/java/ext/com/google/android/android/4.4.2_r1/android-4.4.2_r1.jar ./compile_stubs.sh android-4.4.2_r1.jar

agendreau commented 9 years ago

Hi,

I had this same issue when I stored my jar in a different directory than the stubs directory. Is there potentially a weird path issue if I store the jar somewhere else? The exact sequence of actions in your previous email seemed to fix the problem. It compiled except with the following notes...

Note: Some input files use or override a deprecated API.

Note: Recompile with -Xlint:deprecation for details.

Note: Some input files use unchecked or unsafe operations.

Note: Recompile with -Xlint:unchecked for details.

Thanks!

Alex

On Sat, Dec 13, 2014 at 10:36 AM, Sam Blackshear notifications@github.com wrote:

Hmm, I'm a bit puzzled since this works both on my machine and on the Travis https://travis-ci.org/cuplv/droidel build. Try using this exact sequence of actions (from the stubs directory)

wget http://repository.grepcode.com/java/ext/com/google/android/android/4.4.2_r1/android-4.4.2_r1.jar ./compile_stubs.sh android-4.4.2_r1.jar

— Reply to this email directly or view it on GitHub https://github.com/cuplv/droidel/issues/12#issuecomment-66884191.

sblackshear commented 9 years ago

Hi Alex, Thanks, that's really useful to know! I'll add a note to the README that says you should copy the JAR to the stubs directory.

highwater commented 9 years ago

Hi, Sam..

Those two Jars are different, from your comment, its 4.4.2_r1 whereas in the README and your previous comment it's 4.2.2. So the reason of my errors was because the wrong JAR.

Now I'm using 4.4.2_r1 Jar and it completed with errors same with Alex.

In addition, I also checked about the placement of the Jar in a different directory, the compilation succeeded but with the following error:

ncc@ncc-Lenovo-H520S:~/droidel2/stubs$ ./compile_stubs.sh ~/androidjars/android-19/android.jar 
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
java.io.FileNotFoundException: droidel_/home/ncc/androidjars/android-19/android.jar (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:110)
    at sun.tools.jar.Main.run(Main.java:190)
    at sun.tools.jar.Main.main(Main.java:1177)

Thank you.

sblackshear commented 9 years ago

Hi Coraline, To address this second issue, just copy the JAR into the stubs directory. I've updated the README with instructions to this effect.