Giter Site home page Giter Site logo

androidstarters / kotlin-android-starter Goto Github PK

View Code? Open in Web Editor NEW
601.0 601.0 97.0 1.96 MB

[Kotlin Android] Kotlin Android starter based MVP/Dagger2/RxJava2/Robolectric/Espresso/Mockito. It provides a generator to fast create a Kotlin Android project.

Kotlin 100.00%
android android-mvp-kotlin checkstyle espresso findbugs kotlin mockito mvp pmd robolectric rxjava

kotlin-android-starter's Introduction

androidstarters NPM version Build Status Dependency Status Coverage percentage

Kickstart your next android app in 10 secs.

Installation

$ npm install --save androidstarters

Usage

const androidstarters = require('androidstarters');

const config = {
  appName: 'SampleApp',
  packageName: 'io.sample.app',
  templateName: 'kotlin',
  props: {
    appPackage: 'io.sample.app'
  }
};

androidstarters(config);

License

MIT © Ravindra Kumar

kotlin-android-starter's People

Contributors

adityaladwa avatar gitter-badger avatar humblerookie avatar hynekslahunek avatar michalciolek avatar ravidsrk avatar revedko avatar shivamdev31 avatar tranngoclam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kotlin-android-starter's Issues

build failed in currect code

kotlin-android-starter/app/build/tmp/kapt3/stubs/debug/io/mvpstarter/sample/injection/component/ApplicationComponent.java:15: error: io.mvpstarter.sample.data.remote.PokemonApi cannot be provided without an @Provides-annotated method.
e:

e: public abstract io.mvpstarter.sample.data.DataManager dataManager();
e: ^
e: io.mvpstarter.sample.data.remote.PokemonApi is injected at
e: io.mvpstarter.sample.data.DataManager.(pokemonApi)
e: io.mvpstarter.sample.data.DataManager is provided at
e: io.mvpstarter.sample.injection.component.ApplicationComponent.dataManager()
e: java.lang.IllegalStateException: failed to analyze: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing
at org.jetbrains.kotlin.analyzer.AnalysisResult.throwIfError(AnalysisResult.kt:57)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:138)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:154)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:58)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:103)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.java:51)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:386)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$compile$1$2.invoke(CompileServiceImpl.kt:96)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:889)
at org.jetbrains.kotlin.daemon.CompileServiceImpl$doCompile$$inlined$ifAlive$lambda$2.invoke(CompileServiceImpl.kt:96)
at org.jetbrains.kotlin.daemon.common.DummyProfiler.withMeasure(PerfUtils.kt:137)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.checkedCompile(CompileServiceImpl.kt:916)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.doCompile(CompileServiceImpl.kt:888)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:385)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:323)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.jetbrains.kotlin.kapt3.diagnostic.KaptError: Error while annotation processing
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing(annotationProcessing.kt:90)
at org.jetbrains.kotlin.kapt3.AnnotationProcessingKt.doAnnotationProcessing$default(annotationProcessing.kt:42)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.runAnnotationProcessing(Kapt3Extension.kt:205)
at org.jetbrains.kotlin.kapt3.AbstractKapt3Extension.analysisCompleted(Kapt3Extension.kt:166)
at org.jetbrains.kotlin.kapt3.ClasspathBasedKapt3Extension.analysisCompleted(Kapt3Extension.kt:82)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM$analyzeFilesWithJavaIntegration$2.invoke(TopDownAnalyzerFacadeForJVM.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(TopDownAnalyzerFacadeForJVM.kt:106)
at org.jetbrains.kotlin.cli.jvm.compiler.TopDownAnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration$default(TopDownAnalyzerFacadeForJVM.kt:83)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:377)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler$analyze$1.invoke(KotlinToJVMBytecodeCompiler.kt:68)
at org.jetbrains.kotlin.cli.common.messages.AnalyzerWithCompilerReport.analyzeAndReport(AnalyzerWithCompilerReport.kt:96)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyze(KotlinToJVMBytecodeCompiler.kt:368)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules(KotlinToJVMBytecodeCompiler.kt:133)
... 30 more

generator downloads old version!

The yeoman generator using the "yo kotlin-android" command generates an old version of the project, not the latest as in the repo with moshi and newer versions.

connectedAndroidTest not working

io.mvpstarter.sample.DetailActivityTest > checkErrorViewDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.base.MockitoException:
        Cannot mock/spy class io.mvpstarter.sample.data.DataManager

io.mvpstarter.sample.DetailActivityTest > checkPokemonDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.base.MockitoException:
        Cannot mock/spy class io.mvpstarter.sample.data.DataManager

io.mvpstarter.sample.MainActivityTest > checkErrorViewDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.base.MockitoException:
        Cannot mock/spy class io.mvpstarter.sample.data.DataManager

io.mvpstarter.sample.MainActivityTest > clickingPokemonLaunchesDetailActivity[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.base.MockitoException:
        Cannot mock/spy class io.mvpstarter.sample.data.DataManager

io.mvpstarter.sample.MainActivityTest > checkPokemonsDisplay[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.base.MockitoException:
        Cannot mock/spy class io.mvpstarter.sample.data.DataManager

FAILURE: Build failed with an exception.

converting DataManager.kt to an open class gives

> Task :app:connectedDebugAndroidTest
Starting 5 tests on Nexus_5_API_18(AVD) - 4.3.1

io.mvpstarter.sample.DetailActivityTest > checkErrorViewDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        java.lang.NullPointerException
        at io.mvpstarter.sample.data.DataManager.getPokemon(DataManager.kt:22)

io.mvpstarter.sample.DetailActivityTest > checkPokemonDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
        Misplaced or misused argument matcher detected here:

io.mvpstarter.sample.MainActivityTest > checkErrorViewDisplays[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        java.lang.NullPointerException
        at io.mvpstarter.sample.data.DataManager.getPokemonList(DataManager.kt:14)

io.mvpstarter.sample.MainActivityTest > clickingPokemonLaunchesDetailActivity[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        org.mockito.exceptions.misusing.InvalidUseOfMatchersException:
        Misplaced or misused argument matcher detected here:

io.mvpstarter.sample.MainActivityTest > checkPokemonsDisplay[Nexus_5_API_18(AVD) - 4.3.1] FAILED
        java.lang.NullPointerException
        at io.mvpstarter.sample.data.DataManager.getPokemonList(DataManager.kt:14)


FAILURE: Build failed with an exception.

Can't build the project

Hi,

I have used your yeoman template as described in docs, but it seems that build is broken, as I can't execute ./gradlew script - it fails with:

$ ./gradlew
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

I have tried running it on two OSes, Linux and Mac OS X, I have gradle installed globally on Linux box (4.3.1) and it fails in project with exception telling me: Error: FOR_COMPILE. I don't have global gradle on Mac OS X. End result is the same on both.

Architecture

What do you think about the mindwork's mvp-interactor to be the default or at least an option in kotlin starter?

Moshi

Thank you, for the boilerplate, really awesome work :).
Is it possible to make a pull request to replace Gson by Moshi ? Or maybe have it on another branch

Cannot Evaluate

Hi,,,
how to resolve "Object has been collected Cannot evaluate com.google.gson.Gson.toString()"
my JsonResult Structure same with pokemon API..
thanks
btw great project

Boilerplate looks a little heavy

While the project consists of a really good collection of libraries, It seems we could have a leaner version.
Wouldn't it be a better idea to have a core/lite branch that houses only the essentials and leaves out stuff like sherlock, sqlbrite, chuck etc. which are really a very subjective lot?

failed to add this sample as module

i dded another project as module and tried to add this starter in gradle using this line :

implementation project(path: ':library')

and when i'm trying to sync i'm getting the following error :

Unable to resolve dependency for ':sample@debug/compileClasspath': Could not resolve project :library.

Could not resolve project :library.
Required by:
project :sample

Unable to find a matching configuration of project :library:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration 'debugMetadataElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' but no value provided.
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration 'releaseMetadataElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' but no value provided.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.

i researched it on stack overflow, and the only thing that almost worked for me is to rename my gradle line to this :

implementation project(path: ':library', configuration: 'default')

my sync did work, but i couldn't import any of the project files.

i know that the issue is that the configurations is not identical , but i don't know what i should do to fix this.

implementation problem

Error:Could not find method implementation() for arguments [[com.android.support:cardview-v7:25.3.1, com.android.support:appcompat-v7:25.3.1, com.android.support:design:25.3.1, com.android.support:recyclerview-v7:25.3.1, com.android.support:support-annotations:25.3.1, com.android.support:gridlayout-v7:25.3.1]] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

Please install the Android Support Repository from the Android SDK Manager.
Open Android SDK Manager

gradlew not working on Windows

When I execute:

gradlew app:assembleDebug

I get:

Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain

Java Version:

java version "1.8.0_171"
Java(TM) SE Runtime Environment (build 1.8.0_171-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.171-b11, mixed mode)

gradle --version

------------------------------------------------------------
Gradle 4.7
------------------------------------------------------------

Build time:   2018-04-18 09:09:12 UTC
Revision:     b9a962bf70638332300e7f810689cb2febbd4a6c

Groovy:       2.4.12
Ant:          Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM:          1.8.0_171 (Oracle Corporation 25.171-b11)
OS:           Windows 7 6.1 amd64

failed to add this project as library module

I tried to add another project and sue this one as a module, but i'm getting an error in gradle :

Unable to resolve dependency for ':sample@debug/compileClasspath': Could not resolve project :library.

Could not resolve project :library.
Required by:
project :sample

Unable to find a matching configuration of project :library:
- Configuration 'debugApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration 'debugMetadataElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' but no value provided.
- Configuration 'debugRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found compatible value 'debug'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'debug' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.
- Configuration 'releaseApiElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found compatible value 'java-api'.
- Configuration 'releaseMetadataElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Metadata'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' but no value provided.
- Configuration 'releaseRuntimeElements':
- Required com.android.build.api.attributes.BuildTypeAttr 'debug' and found incompatible value 'release'.
- Required com.android.build.gradle.internal.dependency.AndroidTypeAttr 'Aar' and found incompatible value 'Apk'.
- Found com.android.build.gradle.internal.dependency.VariantAttr 'release' but wasn't required.
- Required org.gradle.usage 'java-api' and found incompatible value 'java-runtime'.

i checked for solution and i only found that i need that the buildTypes will be identical in all of the projects. its already identical as there is only release buildType.

this is my sample project gradle :

`apply plugin: 'com.android.application'

android {
compileSdkVersion 27

defaultConfig {
    minSdkVersion 21
    targetSdkVersion 27
    versionCode 1
    versionName "1.0"

    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

}

buildTypes {
    release {
        minifyEnabled true
        shrinkResources true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

}

apply from: 'dependencies.gradle'

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:27.0.2'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'

implementation project(':library')

}
`

Needs a proguard config

Issue

  • No proguard config.

Log

Warning:okio.DeflaterSink: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:okio.Okio: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement
Warning:retrofit2.Platform$Java8: can't find referenced class org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement

This seems to be lacking a proper proguard rules, Are you guys cool if I contribute?.

Get Error Response Body

Hi, tanks for this great project.

How to get error response body from inside onError? on error only have throwable.

Thanks

kotlin gradle and IDE plugins are different

Im getting this comment from gradle on this line in gradle:
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
the comment is :

kotlin version that is used for building with gradle (1.2.10) differs from the one bundled into the IDE plugin (1.1.60)

Is this ok ?

Error on Instrumented Tests

Hi folks,

I cloned your repository and tried to run the Instrumented Test for the MainActivity (MainActivityTest), but it keeps raising the following error:

org.mockito.exceptions.base.MockitoException:
Cannot mock/spy class io.mvpstarter.sample.data.DataManager
Mockito cannot mock/spy because :
- final class
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule.providesDataManager$app_debug(ApplicationTestModule.kt:39)
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule_ProvidesDataManager$app_debugFactory.get(ApplicationTestModule_ProvidesDataManager$app_debugFactory.java:20)
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule_ProvidesDataManager$app_debugFactory.get(ApplicationTestModule_ProvidesDataManager$app_debugFactory.java:8)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at io.mvpstarter.sample.common.injection.component.DaggerTestComponent.dataManager(DaggerTestComponent.java:69)
at io.mvpstarter.sample.common.TestComponentRule.getMockDataManager(TestComponentRule.kt:32)
at io.mvpstarter.sample.MainActivityTest.stubDataManagerGetPokemonList(MainActivityTest.kt:71)
at io.mvpstarter.sample.MainActivityTest.checkPokemonsDisplay(MainActivityTest.kt:39)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433)
at io.mvpstarter.sample.common.TestComponentRule$apply$1.evaluate(TestComponentRule.kt:40)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:369)
at io.mvpstarter.sample.runner.UnlockDeviceAndroidJUnitRunner.onStart(UnlockDeviceAndroidJUnitRunner.kt:29)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1960)

Is the error "right" or am I doing something wrong?

I also tried to copy the .MockMaker file to the androidTest directory, but it raises another error:

java.lang.IllegalStateException: Could not initialize plugin: interface org.mockito.plugins.MockMaker
at org.mockito.internal.configuration.plugins.PluginLoader$1.invoke(PluginLoader.java:66)
at java.lang.reflect.Proxy.invoke(Proxy.java:393)
at $Proxy4.isTypeMockable(Unknown Source)
at org.mockito.internal.util.MockUtil.typeMockabilityOf(MockUtil.java:29)
at org.mockito.internal.util.MockCreationValidator.validateType(MockCreationValidator.java:22)
at org.mockito.internal.creation.MockSettingsImpl.validatedSettings(MockSettingsImpl.java:186)
at org.mockito.internal.creation.MockSettingsImpl.confirm(MockSettingsImpl.java:180)
at org.mockito.internal.MockitoCore.mock(MockitoCore.java:62)
at org.mockito.Mockito.mock(Mockito.java:1729)
at org.mockito.Mockito.mock(Mockito.java:1642)
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule.providesDataManager$app_debug(ApplicationTestModule.kt:39)
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule_ProvidesDataManager$app_debugFactory.get(ApplicationTestModule_ProvidesDataManager$app_debugFactory.java:20)
at io.mvpstarter.sample.common.injection.module.ApplicationTestModule_ProvidesDataManager$app_debugFactory.get(ApplicationTestModule_ProvidesDataManager$app_debugFactory.java:8)
at dagger.internal.DoubleCheck.get(DoubleCheck.java:47)
at io.mvpstarter.sample.common.injection.component.DaggerTestComponent.dataManager(DaggerTestComponent.java:69)
at io.mvpstarter.sample.common.TestComponentRule.getMockDataManager(TestComponentRule.kt:32)
at io.mvpstarter.sample.MainActivityTest.stubDataManagerGetPokemonList(MainActivityTest.kt:71)
at io.mvpstarter.sample.MainActivityTest.checkErrorViewDisplays(MainActivityTest.kt:65)
at java.lang.reflect.Method.invoke(Native Method)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at android.support.test.rule.ActivityTestRule$ActivityStatement.evaluate(ActivityTestRule.java:433)
at io.mvpstarter.sample.common.TestComponentRule$apply$1.evaluate(TestComponentRule.kt:40)
at org.junit.rules.RunRules.evaluate(RunRules.java:20)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runners.Suite.runChild(Suite.java:128)
at org.junit.runners.Suite.runChild(Suite.java:27)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at android.support.test.internal.runner.TestExecutor.execute(TestExecutor.java:58)
at android.support.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:369)
at io.mvpstarter.sample.runner.UnlockDeviceAndroidJUnitRunner.onStart(UnlockDeviceAndroidJUnitRunner.kt:29)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1960)
Caused by: java.lang.IllegalStateException: Failed to load interface org.mockito.plugins.MockMaker implementation declared in java.lang.TwoEnumerationsInOne@cf7f577
at org.mockito.internal.configuration.plugins.PluginLoader.loadImpl(PluginLoader.java:101)
at org.mockito.internal.configuration.plugins.PluginLoader.loadPlugin(PluginLoader.java:45)
at org.mockito.internal.configuration.plugins.PluginRegistry.<init>(PluginRegistry.java:18)
at org.mockito.internal.configuration.plugins.Plugins.<clinit>(Plugins.java:17)
at org.mockito.internal.configuration.plugins.Plugins.getMockMaker(Plugins.java:33)
at org.mockito.internal.util.MockUtil.<clinit>(MockUtil.java:24)
... 45 more
Caused by: org.mockito.exceptions.base.MockitoInitializationException:
Could not initialize inline Byte Buddy mock maker. (This mock maker is not supported on Android.)

I have a project similar to yours, and I'm struggling almost a week to configure Mockito 2.x + Dagger 2 + Kotlin.

Regards,
Luan.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.