I have split my project into two modules: app and domain, there should be more for clean-architecture, but I have met a problem before I want to move forward.
I have added a new module :domain:
and added a test
folder inside, and moved my tests from the :app
module into this folder. Unfortunately while testing the file I have met the error
java.lang.NoClassDefFoundError Lbel/mobile/domain/interactor/accounts/GetAccountsList;
Caused by: java.lang.ClassNotFoundException:bel.mobile.domain.interactor.accounts.GetAccountsList
Here is my build.gradle file for module domain:
apply plugin: 'java'
apply plugin: 'kotlin'
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
buildscript {
ext.kotlin_version = '1.2.10'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "io.reactivex.rxjava2:rxjava:$project.ext.rxJavaVersion"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "junit:junit:$project.ext.junitVersion"
implementation "org.mockito:mockito-core:$project.ext.mockitoVersion"
implementation "com.google.truth:truth:$project.ext.truthVersion"
}
Here is domain.iml file:
<?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id=":domain" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android-gradle" name="Android-Gradle">
<configuration>
<option name="GRADLE_PROJECT_PATH" value=":domain" />
</configuration>
</facet>
<facet type="java-gradle" name="Java-Gradle">
<configuration>
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
<option name="BUILDABLE" value="true" />
</configuration>
</facet>
<facet type="kotlin-language" name="Kotlin">
<configuration version="3" platform="JVM 1.8" useProjectSettings="false">
<compilerSettings />
<compilerArguments>
<option name="destination" value="$MODULE_DIR$/build/classes/kotlin/main" />
<option name="noStdlib" value="true" />
<option name="noReflect" value="true" />
<option name="moduleName" value="domain" />
<option name="jvmTarget" value="1.8" />
<option name="addCompilerBuiltIns" value="true" />
<option name="loadBuiltInsFromDependencies" value="true" />
<option name="languageVersion" value="1.2" />
<option name="apiVersion" value="1.2" />
<option name="pluginOptions">
<array />
</option>
<option name="pluginClasspaths">
<array />
</option>
</compilerArguments>
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/build/classes/java/main" />
<output-test url="file://$MODULE_DIR$/build/classes/java/test" />
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/test/kotlin" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/src/test/resources" type="java-test-resource" />
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" exported="" scope="PROVIDED" name="rxjava-2.1.6" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="kotlin-stdlib-jdk8-1.2.10" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="truth-0.39" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="junit-4.12" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="mockito-core-2.8.9" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="reactive-streams-1.0.1" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="kotlin-stdlib-jdk7-1.2.10" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="kotlin-stdlib-1.2.10" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="hamcrest-core-1.3" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="byte-buddy-1.6.14" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="byte-buddy-agent-1.6.14" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="objenesis-2.5" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="guava-23.4-android" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="error_prone_annotations-2.1.3" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="annotations-13.0" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="jsr305-1.3.9" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="j2objc-annotations-1.1" level="project" />
<orderEntry type="library" exported="" scope="PROVIDED" name="animal-sniffer-annotations-1.14" level="project" />
</component>
</module>
What I have tried to do so far:
- I have tried many different ways and checked many solutions regarding the same error to solve the problem, but none of them fix it
- I have checked that simple test is working inside of this folder.
- I have added Multidex
Aucun commentaire:
Enregistrer un commentaire