在我的项目中(如果您需要详细信息,可以找到它on Github)我有两个模块:
我已经开始在app模块中充实我的MVP课程,我想重用PredefinedRandomIntegerGenerator
中的module
类(on Github)(居住在在test
模块的单元测试中,该模块的app
文件夹。
当我开始编写测试代码时,我遇到了没有问题,直到我开始运行
C:\Projects\Dice-Statistics\app\src\test\java\com\xilconic\dicestatistics\viewmodels\SixSidedDieRollingViewModelTest.java:5: error: package com.xilconic.gaming.dice.test.mocks does not exist
import com.xilconic.gaming.dice.test.mocks.PredefinedRandomIntegerGenerator;
^
C:\Projects\Dice-Statistics\app\src\test\java\com\xilconic\dicestatistics\viewmodels\SixSidedDieRollingViewModelTest.java:21: error: cannot find symbol
RandomIntegerGenerator rng = new PredefinedRandomIntegerGenerator(results);
^
symbol: class PredefinedRandomIntegerGenerator
location: class SixSidedDieRollingViewModelTest
我不知道为什么在构建期间无法找到com.xilconic.gaming.dice.test.mocks包。我在app
模块的Gradle脚本中遗漏了什么?这看起来如下:
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "com.xilconic.dicestatistics"
minSdkVersion 8
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.android.support:design:23.1.1'
compile project(':dice')
}
非常欢迎任何帮助!