any idea?:)
# kodein
h
any idea?:)
a
are you using proguard or something similar?
h
yeah but without any fancy setup
do you think proguard is the culprit?
I switched it off, same issue 😕
a
yeah, in most of the cases where this error occurs, because proguard replaces unused classes with
Object
can you show us the code with the bindings?
h
sure
Copy code
class UserProviderImpl() : UserProvider {

    override fun getUser() {
    }

}`

val userProviderModule = Kodein.Module {
    bind<UserProvider>() with singleton { UserProviderImpl() }
}
Copy code
class AssignmentProviderImpl() : AssignmentProvider {

    override fun getAssignments(): List<AssignmentViewModel> {
        return arrayListOf()
    }
}

val assignmentProviderModule = Kodein.Module {
    bind<AssignmentProvider>() with singleton { AssignmentProviderImpl() }
}
these are the new ones
in my application
Copy code
override val kodein by Kodein.lazy {
        import(analyticsModule)
        import(userProviderModule)
        import(assignmentProviderModule)
        import(apiModule)
    }
analytics module has
Copy code
val analyticsModule = Kodein.Module {
    bind<GMAnalytics>() with singleton {
        GMAnalyticsImpl(
            instance()
        )
    }
}
and api module has
Copy code
val apiModule = Kodein.Module {
    bind<GMApi>() with singleton { GMApiImpl(GMApiService.create()) }
}
If I’m not using the
import(userProviderModule) import(assignmentProviderModule)
in the applicaion
then everything is fine
Copy code
# Some methods are only called from tests, so make sure the shrinker keeps them.
-keep class com.example.android.architecture.blueprints.** { *; }

-keep class android.support.v4.widget.DrawerLayout { *; }
-keep class android.support.test.espresso.IdlingResource { *; }
-keep class android.support.test.espresso.IdlingRegistry { *; }
-keep class com.google.common.base.Preconditions { *; }
-keep class android.databinding.** { *; }
-keep class android.arch.** { *; }

# For Guava:
-dontwarn javax.annotation.**
-dontwarn javax.inject.**
-dontwarn sun.misc.Unsafe

# Proguard rules that are applied to your test apk/code.
-ignorewarnings

-keepattributes *Annotation*

-dontnote junit.framework.**
-dontnote junit.runner.**

-dontwarn android.test.**
-dontwarn android.support.test.**
-dontwarn org.junit.**
-dontwarn org.hamcrest.**
-dontwarn com.squareup.javawriter.JavaWriter
# Uncomment this if you use Mockito
-dontwarn org.mockito.**
this is my proguard
a
please put the code in 3 backticks if its more than a line
h
yeah sorry
changed
any idea?:(
one additional thing
I have a baseclass for my activites and for my fragments with the injector codes
like
a
does it work if you disable proguard and do a clean build?
h
let me retry
wow
I injected all of them and used a function from all of them
and now it’s working
it was definitely proguard
a
Seems like you are missing that statement in your proguard-config too https://salomonbrys.github.io/Kodein/#_using_proguard
not sure if its still up-to-date
h
I actually have it
so it must be a different one
a
then you could probably tell proguard to keep the classes you are binding with
-keep class ...
h
later it shouldn’t be a problem, as these objects will be used. I just kickstarted a new project so there wasn’t any functionality in these objects