WALA icon indicating copy to clipboard operation
WALA copied to clipboard

assert "Dalvik".equals(System.getProperty("java.vm.name")); in dalvik.test

Open 3ntr0phy opened this issue 7 years ago • 18 comments

Hi, I am starting working with WALA for make an android static analysis tool. I wanted to ask how am I supposed to resolve this error, because if it seems that the framework is expected to run in a dalvik VM, but I just would like to analyze an apk on Ubuntu. Thanks in advance.

PS: there are some tutorials on WALA with Android more than https://github.com/wala/Examples, which have the same issue?

3ntr0phy avatar Aug 28 '18 16:08 3ntr0phy

@Jacoppy we're going to need some more details on what exactly you're trying to do (exact commands, etc.) in order to understand the problem here.

msridhar avatar Aug 28 '18 17:08 msridhar

I am just trying to run the dalvik tests and I get Assertion Error due to this : Dalvik".equals(System.getProperty("java.vm.name")); If you take for example com.ibm.wala.dalvik.drivers.APKCallGraphDriver.java I get this error when it tries to launch Util.androidLibs(); Am I supposed to provide specific libraries? Thanks

3ntr0phy avatar Aug 28 '18 17:08 3ntr0phy

^ @juliandolby?

Maybe we need to better document what needs to be installed on the system to run the Dalvik tests. Our Travis config uses a base image with Android stuff installed, so I imagine you might need the SDK installed.

msridhar avatar Aug 28 '18 17:08 msridhar

I have Android Studio installed in, I have just seend that the function libs in com.ibm.wala.dalvik.drivers.APKCallGraphDriver.java searches for actually some libraries into a folder libs. I tried to put inside the android.jar of different SDK version but I have other errors so I am not pretty sure what to do. Anyway I would need WALA for build up an Android slicer, there is maybe some usefull doc around? I really appreciate your help @msridhar . Thanks :)

3ntr0phy avatar Aug 28 '18 17:08 3ntr0phy

I tried also to install the same version of your build tools, 26.0.2, and copy all the jars and dex inside that folder but now I have this issue: using /tmp/name1264526317189494409_classes.dex java.lang.NullPointerException: entry at java.util.zip.ZipFile.getInputStream(ZipFile.java:361) at java.util.jar.JarFile.getInputStream(JarFile.java:447) at com.ibm.wala.dalvik.classLoader.DexFileModule.(DexFileModule.java:99) at com.ibm.wala.dalvik.classLoader.DexFileModule.make(DexFileModule.java:80) at com.ibm.wala.dalvik.util.AndroidAnalysisScope.setUpAndroidAnalysisScope(AndroidAnalysisScope.java:51) at com.ibm.wala.dalvik.test.util.Util.makeDalvikScope(Util.java:105) at com.ibm.wala.dalvik.test.callGraph.DalvikCallGraphTestBase.makeAPKCallGraph(DalvikCallGraphTestBase.java:111) at tutorial.examples.CreateSDGForAPK.main(CreateSDGForAPK.java:97)

3ntr0phy avatar Aug 28 '18 17:08 3ntr0phy

@Jacoppy can you see if ./gradlew test :com.ibm.wala.dalvik.test:test works for you? Warning: it may download a lot of stuff (like its own copy of the SDK)

msridhar avatar Aug 28 '18 18:08 msridhar

Yes this is my output: Parallel execution is an incubating feature.

BUILD SUCCESSFUL in 6m 11s 106 actionable tasks: 13 executed, 93 up-to-date

3ntr0phy avatar Aug 28 '18 18:08 3ntr0phy

Ok so the tests pass! So how were you trying to run tests before? I think the solution will be in fixing config to be more like the Gradle build.

msridhar avatar Aug 28 '18 18:08 msridhar

Well, I have tried both gradle and JUnit tests. Even if these gradle tests works, the JUnit have some issues, as the Assertion error I mentioned you in testJLex, com.ibm.wala.dalvik.test.callGraph.JVMLDalvikComparisonTest . I also tried to use /com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/drivers/APKCallGraphDriver.java with another APK, not only the one tested and I got those errors. Same thing for the examples here : https://github.com/wala/Examples , after having imported the needed dependency and having customized the launcher with an apk of mine, it throws those errors. Maybe all these things are not needed but were the only materials I found on Android.

3ntr0phy avatar Aug 28 '18 18:08 3ntr0phy

How are you running tests? In Eclipse? IntelliJ?

On Tue, Aug 28, 2018 at 11:30 AM Jacoppy [email protected] wrote:

Well, I have tried both gradle and JUnit tests. Even if these gradle tests works, the JUnit have some issues, as the Assertion error I mentioned you in testJLex, com.ibm.wala.dalvik.test.callGraph.JVMLDalvikComparisonTest . I also tried to use /com.ibm.wala.dalvik.test/source/com/ibm/wala/dalvik/drivers/APKCallGraphDriver.java with another APK, not only the one tested and I got those errors. Same thing for the examples here : https://github.com/wala/Examples , after having imported the needed dependency and having customized the launcher with an apk of mine, it throws those errors. Maybe all these things are not needed but were the only materials I found on Android.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wala/WALA/issues/346#issuecomment-416693110, or mute the thread https://github.com/notifications/unsubscribe-auth/AALyUYkq3NztVf_fPRXyU4VhNsQkPyxOks5uVYxHgaJpZM4WQBRc .

msridhar avatar Aug 28 '18 18:08 msridhar

Eclipse

3ntr0phy avatar Aug 28 '18 18:08 3ntr0phy

Being more precise, Eclipse photon on Ubuntu 18.04 .

3ntr0phy avatar Aug 28 '18 18:08 3ntr0phy

Ok, I don't use Eclipse anymore. We'll need help from @juliandolby here

On Tue, Aug 28, 2018 at 11:37 AM Jacoppy [email protected] wrote:

Being more precise, Eclipse photon on Ubuntu 18.04 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wala/WALA/issues/346#issuecomment-416695182, or mute the thread https://github.com/notifications/unsubscribe-auth/AALyUWIgx3LMsnsRg27ku-rP8ofWc48Sks5uVY3QgaJpZM4WQBRc .

msridhar avatar Aug 28 '18 18:08 msridhar

Okay, anyway the good thing is that all gradle tests work correctly. I'll keep digging into WALA for answers, but keep me updated please @msridhar @juliandolby . Thank you very much @msridhar and sorry for bothering.

3ntr0phy avatar Aug 28 '18 18:08 3ntr0phy

No problem, glad to help!

On Tue, Aug 28, 2018 at 11:44 AM Jacoppy [email protected] wrote:

Okay, anyway the good thing is that all gradle tests work correctly. I'll keep digging into WALA for answers, but keep me updated please @msridhar https://github.com/msridhar @juliandolby https://github.com/juliandolby . Thank you very much @msridhar https://github.com/msridhar and sorry for bothering.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/wala/WALA/issues/346#issuecomment-416697531, or mute the thread https://github.com/notifications/unsubscribe-auth/AALyUdPGs8LB0JseBmaCTpOr6L7wFVUDks5uVY-DgaJpZM4WQBRc .

msridhar avatar Aug 28 '18 18:08 msridhar

@Jacoppy I am having a similar issue. Please email [email protected] if you were able to come up with a solution. Willing to work with you to resolve this issue.

baileynottingham avatar Oct 16 '18 04:10 baileynottingham

Hey @baileynottingham , do the tests run for you? If I do not remember wrong, I had to compile everything using gradle by hand, project by project, more than using the final gradle wrapper. But if you need more assistance feel free to text me!

3ntr0phy avatar Oct 17 '18 10:10 3ntr0phy

In order to actually help here, we need step-by-step instructions on how to reproduce.

msridhar avatar Oct 17 '18 16:10 msridhar