Last active
August 29, 2015 13:56
-
-
Save huberflores/9168683 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* author Huber Flores | |
*/ | |
#This is a set of instruction to utilize the code offloading converter at https://github.com/huberflores/CodeOffloadingAnnotations.git | |
1) Clone the repository and built the tool using mvn install | |
2) Create an Android project with the code to offload. Annotated the required method to offload with "@Cloud" | |
for example | |
@Cloud | |
public void foo(){ | |
} | |
3) Use the tool to generate two new applications. One for server, and the other for client. | |
4) Locate the server and client, in their respective locations - For simplicity, use Android maven -> check (https://gist.github.com/huberflores/9168757) for Technical information | |
4-1) ProjectName_Server | |
- Import into Eclipse | |
- Remove the annotations. The project should be without any error. | |
- Transform to maven | |
Click root project -> right click -> Configure -> Convert to Maven Project | |
fill the required data. Important "In the packing description, put apk" | |
go to the pom.xml, and include this information. Below, a sample pom.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>edu.ut</groupId> | |
<artifactId>OffloadableComponent_Server</artifactId> | |
<version>1.0</version> | |
<packaging>apk</packaging> | |
<name>OffloadableComponent_Server</name> | |
<properties> | |
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
<platform.version>4.1.1.4</platform.version> | |
<android.plugin.version>3.6.0</android.plugin.version> | |
</properties> | |
<dependencies> | |
<dependency> | |
<groupId>com.google.android</groupId> | |
<artifactId>android</artifactId> | |
<version>${platform.version}</version> | |
<scope>provided</scope> | |
</dependency> | |
</dependencies> | |
<build> | |
<sourceDirectory>src</sourceDirectory> | |
<finalName>${project.artifactId}</finalName> | |
<pluginManagement> | |
<plugins> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<version>${android.plugin.version}</version> | |
<extensions>true</extensions> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-compiler-plugin</artifactId> | |
<configuration> | |
<source>1.6</source> | |
<target>1.6</target> | |
</configuration> | |
</plugin> | |
<plugin> | |
<groupId>com.jayway.maven.plugins.android.generation2</groupId> | |
<artifactId>android-maven-plugin</artifactId> | |
<configuration> | |
<sdk><platform>14</platform></sdk> | |
<emulator> | |
<avd>MiniSample4</avd> | |
</emulator> | |
</configuration> | |
<extensions>true</extensions> | |
</plugin> | |
</plugins> | |
</build> | |
</project> | |
-Eclipse IDE | |
Click root project - Menu "Project" - clean | |
Click root project - Rigth click - maven -> Update Project | |
-Project should be ready for building via "mvn install" from console | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] BUILD SUCCESS | |
[INFO] ------------------------------------------------------------------------ | |
[INFO] Total time: 5.849s | |
[INFO] Finished at: Sun Feb 23 09:51:37 EET 2013 | |
[INFO] Final Memory: 26M/344M | |
- Upload to the cloud via scp. The apk should be located in the android-x86 folder, which contains ./rund.sh | |
$ scp -i /home/huber/Desktop/TechnicalInformation/HuberFlores/Ireland/pk-huber_flores.pem -r ./file_name.apk ubuntu@ec2-54-195-71-139.eu-west-1.compute.amazonaws.com:/home/ubuntu/android-x86/ | |
Start the server in the instance | |
$ ./rund.sh -cp OffloadableComponent_Server.apk edu.ut.mobile.network.Main | |
4-2) ProjectName_Client | |
- Import into Eclipse | |
- Remove the annotations | |
- Install thea app in your device. However, check that the application has the permissions required in the Android manifest. (e.g. Internet) | |
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="com.cloud.cloudTest" | |
android:versionCode="1" | |
android:versionName="1.0" > | |
<uses-sdk | |
android:minSdkVersion="8" | |
android:targetSdkVersion="17" /> | |
<application | |
android:allowBackup="true" | |
android:icon="@drawable/ic_launcher" | |
android:label="@string/app_name" | |
android:theme="@style/AppTheme" > | |
<activity | |
android:name="MainActivity" | |
android:label="@string/app_name" > | |
<intent-filter> | |
<action android:name="android.intent.action.MAIN" /> | |
<category android:name="android.intent.category.LAUNCHER" /> | |
</intent-filter> | |
</activity> | |
<service android:enabled="true" android:name="CloudService"/> | |
<service android:enabled="true" android:name="LocalService"/> | |
</application> | |
<uses-permission android:name="android.permission.INTERNET"> </uses-permission> | |
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"> </uses-permission> | |
</manifest> | |
-Run the application in your device/emulator | |
5) Get results | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment