As I'm doing some unit test on Android, I usually use Robotium.
The core of this tool is really powerful but I made some helper classes and I would like to export them in a separate project so I can re-use them in all my projects.
So I created a new Android Studio library project in order to put my classes inside.
My build.gradle
is like:
apply plugin: 'com.android.library'
android {
compileSdkVersion 22
buildToolsVersion "22.0.1"
defaultConfig {
minSdkVersion 8
targetSdkVersion 22
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:22.1.1'
compile 'com.android.support:support-v4:22.1.1'
compile 'com.jayway.android.robotium:robotium:5.3.1'
}
And my classes are under my package (modoule/src/main/java/package/).
The thing is, my classes are using some Robotium objects (like Solo
) and my project can't resolve the import com.robotium.solo.Solo;
I'm stuck on that. The goal is not to do unit test, but to do a kind of plug-in for Robotium
that I will use in my projects by adding this to their build.gradle
dependencies {
...
androidTestCompile 'com.jayway.android.robotium:robotium:5.3.1'
androidTestCompile 'mytools:module:version'
}
What might be wrong?
I think the object Solo can't be access in the scope "compile".
You can use the following dependency in replacement:
dependencies {
compile 'com.jayway.android.robotium:robotium-solo:5.3.1'
}
Enjoy :)