Android Studio and MonkeyTalk?

Has anyone successfully configured MonkeyTalk with Android Studio?

My main problem at this point is that I don’t see a way to install the java compiler in aspectj

I believe that this can be done in custom_rules.xml, but I have not yet seen how to do this.

This leads to a possibly unrelated problem, but in the latest version of Android Studio that I use (0.1.1), I don’t see a way to run ant builds from within Android Studio.

Any suggestions appreciated!

+8
android android-studio aspectj ant monkeytalk
source share
4 answers

The approach I found works well - use the android- gradle -aspject-j plugin found here https://github.com/uPhyca/gradle-android-aspectj-plugin

What I did was create a new type of assembly (monkeytalk) by including a monkey jar of discussion as a compilation dependency for that type of assembly only and using the aforementioned aspectj plugin. This ensures that the monkey speaks about weaving for the type of assembly of the monkey.

Here is a snippet of what my xml xml looks like.

buildscript { repositories { mavenCentral() } dependencies { classpath 'com.uphyca.gradle:gradle-android-aspectj-plugin:0.9.5' } } apply plugin: 'com.android.application' apply plugin: 'android-aspectj' android { buildTypes { monkeytalk.initWith(buildTypes.debug) monkeytalk { applicationIdSuffix ".monkey" } } } dependencies { monkeytalkCompile(files("monkey-talk/monkeytalk-agent-2.0.5.jar")) } 

I also added the AndroidManifest.xml file for the monkey talk build types, which adds the required permissions, i.e. GET_TASKS and INTERNET

For a complete sample application, look at this github repo https://github.com/georgepapas/android-gradle-monkey-talk-demo/

+6
source share

MonkeyTalk (since version 2.0.1) has now released tools for the "tool" of your already built regular apk with MonkeyTalk regardless of any IDE. Steps to complete this tool in OS X:

1.Download MonkeyTalk 2.0.1 Pro Beta

2. Create a new empty folder on your desktop called “example” or whatever you like

3.Copy monkeytalkpro / agents / android / monkeytalk-agent-2.0.1.jar to the "example" directory

4.Copy monkeytalkpro / ant / monkeytalkpro- ant -2.0.1.beta.jar to the directory "example"

5. Copy the apk file to the "example" directory (named myapp.apk for this example)

6. Create a new file called build.xml in the "example" directory and fill it as follows:

 <?xml version="1.0" encoding="UTF-8"?> <project xmlns:mt="antlib:com.gorillalogic.monkeytalk.ant"> <target name="instru"> <mt:instrument srcfile="myapp.apk" destfile="myapp-post-instrumented.apk" agent="monkeytalk-agent-2.0.1.jar" androidsdk="/path/to/your/sdk" androidtarget="android-17" log="log.txt" verbose="true" /> </target> </project> 

7. Disable terminal and cd in the "example" directory

8.Use the command ant instru -lib monkeytalkpro-ant-2.0.1.beta.jar

9. The command should be launched and then create monkeytalk compatible apk in your "sample" directory called "myapp-post-instrumented.apk"

A WARNING. There seems to be an error when the toolkit process also places another file in your "sample" directory called "myapp-instrumented.apk", but this file will be empty. So make sure your destination file is not named "myapp-instrumented.apk" in the build.xml file, or that this empty file will overwrite your monkeytalk compatible file.

+3
source share

Android studio is built on the release of the Intellij community, which, as far as I know, does not have built-in support for AspectJ.

You can try adding the Intellij AspectJ plugin - it looks like this should allow you to configure AspectJ in Android Studio, although I don’t know, t actually tried to get MonkeyTalk to work with this yet.

+1
source share

If your Android Studio project is a Maven type, all you have to do is add some AspectJ dependencies, a MonkeyTalk-Agent dependency, and make a maven profile with a setting for those dependencies.

First you will need to deploy the previously downloaded (available here ) jar file with MonkeyTalk-Agent for Android for your local Maven repository. If you have the correct maven configuration, you can do this with the following command:

 mvn install:install-file -Dfile=monkeytalk-agent-2.0.4.jar -DgroupId="com.gorillalogic.monkeytalk" -DartifactId="monkeytalk-agent" -Dversion="2.0.4" -Dpackaging="jar" 

When you successfully complete this part, you can edit the existing POM file of your project and add the following project dependencies:

  <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjtools</artifactId> <version>1.6.2</version> <scope>provided</scope> </dependency> <dependency> <groupId>com.gorillalogic.monkeytalk</groupId> <artifactId>monkeytalk-agent</artifactId> <version>2.0.4</version> </dependency> 

The next step is to create a maven profile that MonekyTalk can add at build time:

 <profile> <id>monkeytalk</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.4</version> <configuration> <source>1.6</source> <target>1.6</target> <aspectLibraries> <aspectLibrary> <groupId>com.gorillalogic.monkeytalk</groupId> <artifactId>monkeytalk-agent</artifactId> </aspectLibrary> </aspectLibraries> <showWeaveInfo>true</showWeaveInfo> <verbose>true</verbose> <Xlint>ignore</Xlint> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> 

The next step is to edit the application manifest file, providing the following permissions:

 <!-- Monkeytalk permission --> <uses-permission android:name="android.permission.GET_TASKS"/> 

You are now set up and ready to create the MonkeyTalk app. To do this, you just need to use the new monkeytalk profile when creating the maven project. Command line usage example:

 clean install android:deploy android:run -Pmonkeytalk 

Now you can connect to your application through the MonkeyTalk IDE, available here .

0
source share

All Articles