Run monkeytalk .mt file in the android project with gradle on the eclipse ide

hello, i want to run monkeytalk .mt file which is in my android application directory on the eclipse ide, i have simple android project and have build.gradle file, have single .mt file in the same project , i added aspectj-runtime library in my project, i am using the java command to run the .mt file on the emulator, this throwing error Connection refuse if i try to run that .mt file on the debug.apk which is created by gradle(build/ output/ *.apk) , but the same .mt file runs good if i run it on the regular .apk that generated by eclipse(bin/ *.apk) , i think aspectj runtime library not get compile with the gradle , or can say its not get included into the classpath, plz anyone help me here…

  1. Import application in the workspace along with all libraries.

  2. Right click on main project – export – android- generate gradle build file

  3. Now run each each libraries first with the gradle , go to command line upto your library project path and use command >> gradle clean assemble

  4. Then build main project with the same processif build successfully then folder “build” will be genarate in your main project and library projects.

  5. Now create folder with the name “monkey_libs” in project directory.

  6. Copy the monkeytalk agent library into it.

  7. Right click on project → configure – convert into Apsectj Project.

  8. Aspectj runtime library will get included into your project.

  9. Right click on the monkeytalk agent library – aspectj tools – add to aspectjpath.

  10. Install simple apk which is generated by eclipse into the emulator, rigth click on project – run as - android application.

  11. java.lang.NoClassDefFoundError: org.aspectj.runtime.reflect.Factory this error might come, go to project property , right click on project -property - java build path– add check the checkbox for aspectj runtime library and monkeyatlk agent library.

  12. Error generating final archive: Found duplicate file for APK: about.html might come means any of your two libraries contain about.html, delete one about.html of one library, copy the library outside say on desktop right click – 7 zip – open archieve – delete about.html and now copy that file into the same libs location , that might be overide.

  13. Finally anyhow run your eclipse generated apk on emulator.

  14. Go to monkeytalk IDE, file – new -project- monkeytalk project – android – provide the name of the test project and test class name – finish.

  15. Connect your emulator where your application is open to the monkeytalk IDE, there Is one button at the top of th e IDE.

  16. Click on the record button at the top of the IDE. And start to do some event on the application like providing input to the editbox or click on button and that get recorded into the .mt file. Now click on home button of emulator.

  17. Again click on connect button , select your emulator.

  18. You can see ERROR java.lang.SecurityException : Permission Denial: getTasks() from pid=2090, error in the console of the Monkeytalk IDE. So here you have to give INTERNET and GET_TASK permission in your main application which is in eclipse.

  19. android.permission.INTERNET"

  20. android.permission.GET_TASKS"

  21. Now you have to run your project again from eclipse into the emulator by deleting old apk. Right click on the project – run as – android application.

  22. Go to monkeytalk IDE , connect your emulator to IDE. Click on play button. Your test starts.

  23. Copy .mt file from monkey IDE to the eclipse project.close the monkey IDE.

  24. Create one folder aspectj_libs into the project directory.copy aspectj-runtime jar file into it. Remove aspectj runtime library from build path , right click on the aspectj runtime library – remove from build path , because now we have jar file of it.right click on the jar and add to build path.

  25. Add android gradle aspectj plugin into the libs folder and add to build path.

  26. Download the android gradle aspectj plugin project from the internet and unzip it.

  27. Go to test folder inside it, src – main – there is one menifest file copy that file into your main package which is in the src directory of your project. In the same path of the plugin go to java\com\uphyca\gradle\android\aspectj and you will find GoodByeAspect.aj copy this into your eclipse project main package.

  28. Now we have to update build.gradle file.

  29. Add classpath ‘com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.8’ into the external dependencies.

  30. apply plugin: ‘android-aspectj’

  31. configurations {

           compile {
                    description = 'compile classpath'
                    transitive = true
            runtime {
                    extendsFrom compile
    }                                                    above the dependencies add above code.
  32. Add below line into the dependencies

  33. compile files(“monkey_libs/monkeytalk-agent-2.0.10.jar”)
    runtime files(“aspectj_libs/org.aspectj.runtime_1.7.3.20130613144500-a.jar”)

  34. now in command prompt >> gradle clean assemble

  35. build successful – yes – then >> gradle installDebug , emulator should be open this will install debig.apk which is generated by gradle on emulator.

  36. Now we have to run .mt file means test on your debug.apk

  37. so that require java command

  38. open your project into the emulator.

  39. Below command is use to run .mt file

  40. java -jar C:\Users\xpointers\Documents\Downloads\monkeytalkpro-2.0.10-beta-win32\monkeytalkpro\runner\monkeytalkpro-runner-2.0.10.beta.jar -agent AndroidEmulator

  41. and your test will get start.