With the Gradle plugin, the test app must be built from the main project. You cannot reference another app project.
On Fri, Mar 7, 2014 at 2:37 AM, Stefan Girlich <[email protected]>wrote: > Hi, > > I am currently struggling to link an Android Application project to > another Android Application project used for running Robotium black-box > tests. > > > *Tools* > > - gradle:1.10 > - Android Development Tools:22.3.0.v201310242005-887826 > - eclipse: 20140224-0627 (Kepler) > > > *Project setup* > > *MainAppProject* > > - contains the actual app that should be tested > - dependencies: *androidannotations:2.7.1*, Android support lib:19.0.1 > > > *TestProject* > > - uses Robotium for black-box testing *MainAppProject* > - dependencies: *robotium-solo:5.0.1*, Android support lib:19.0.1, > *MainAppProject* > > > > *Issue* > > In Eclipse, running the black-box tests in *TestProject* works fine after > simply adding *MainAppProject* as a dependency to the build path through > *Properties > > Java Build Path > Projects*. > However, when running on command line (e.g. using *gradle assembleDebug* or > any other build command), building will fail because the packages and > classes from *MainAppProject* can not be found: > > > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:7: > package com.myproject.progress.ui does not exist > import com.myproject.progress.ui.ProgressActivity_; > ^ > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:8: > package com.myproject.search.ui does not exist > import com.myproject.search.ui.SearchActivity_; > ^ > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:12: > cannot find symbol > symbol: class SearchActivity_ > public class SimpleRobotiumTest extends > ActivityInstrumentationTestCase2<SearchActivity_> { > ^ > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:28: > cannot find symbol > symbol : class SearchActivity_ > location: class com.myproject.test.ui.SimpleRobotiumTest > super(SearchActivity_.class); > ^ > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:44: > cannot find symbol > symbol : class ProgressActivity_ > location: class com.myproject.test.ui.SimpleRobotiumTest > solo.waitForActivity(ProgressActivity_.class); > ^ > /Users/developer/projects/MyProject/TestProject/src/com/myproject/test/ui/SimpleRobotiumTest.java:45: > cannot find symbol > symbol : class ProgressActivity_ > location: class com.myproject.test.ui.SimpleRobotiumTest > solo.assertCurrentActivity("Launched Activity is not ProgressActivity", > ProgressActivity_.class); > ^ > 6 errors > :TestProject:compileDebugJava FAILED > > FAILURE: Build failed with an exception. > > * What went wrong: > Execution failed for task ':TestProject:compileDebugJava'. > > Compilation failed; see the compiler error output for details. > > > *Approaches I have tried* > > *Using 'android-library' instead of 'android' as a plugin in > TestProject/build.gradle* > > This will result in a failure when building on command line: *Could not > find method buildTypes() for arguments > [build_ub9n2bjgrgcslb90jgp27kmep$_run_closure2_closure8@634c803d] on > project ':TestProject'.* > > > *Adding all MainProject source directories to **TestProject/build.gradle, > e.g.: sourceSets.main.java.srcDirs = ['src', '../MainAppProject/src']* > > This will result in the same error output as when not including the > additional source paths. > > > Any piece of information is appreciated, thanks in advance!! > > > > > > -- > You received this message because you are subscribed to the Google Groups > "adt-dev" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- Xavier Ducrohet Android SDK Tech Lead Google Inc. http://developer.android.com | http://tools.android.com Please do not send me questions directly. Thanks! -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
