Android test cannot find source class -
i'm trying configure android app run tests robolectric. i'm new gradle, , can't find out problem is. when run ./gradlew robolectric on command line, cannot find symbol error.
the error is:
mainactivitytest.java:18: error: cannot find symbol robolectric.buildactivity(mainactivity.class).get().getresources(); ^ symbol: class mainactivity location: class mainactivitytest
this build.gradle file:
apply plugin: 'com.android.application' apply plugin: 'robolectric' android { compilesdkversion 20 buildtoolsversion "20.0.0" defaultconfig { applicationid "com.app.id" minsdkversion 16 targetsdkversion 20 versioncode 1 versionname "1.0" } buildtypes { release { runproguard false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } lintoptions { abortonerror false } sourcesets{ main.setroot('src/main') androidtest.setroot('src/test') } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) androidtestcompile 'org.robolectric:robolectric:2.3' androidtestcompile 'junit:junit:4.11' }
so, problem seems cannot access source file when run tests, couldn't find way prepare it.
can tell me i'm doing wrong? thanks!
main.setroot('src/main') => main folder / bundle in project?
you can test 1 time again using file directory, ex: src/helloword/mainactivity.java
android android-gradle robolectric
No comments:
Post a Comment