Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IncompatibleClassChangeError on Android 5.0-6.0 #17

Open
mik9 opened this issue Mar 23, 2018 · 6 comments
Open

java.lang.IncompatibleClassChangeError on Android 5.0-6.0 #17

mik9 opened this issue Mar 23, 2018 · 6 comments

Comments

@mik9
Copy link

mik9 commented Mar 23, 2018

Exception message in runtime:

Class 'ua.pl.mik.app.DaggerAppComponent$SomeLongNameBuilder' does not implement interface 'ua.pl.mik.app.net.ApiComponent$Builder' in call to 'ua.pl.mik.app.net.ApiComponent ua.pl.mik.app.net.ApiComponent$Builder.build()

Class names was changed a bit.
On Android 7.0+ same apks (main + androidTest) working fine.

@tmurakami
Copy link
Owner

If you have a custom AndroidJUnitRunner, please make sure that the class literal of your Application class is not used on AndroidJUnitRunner#newApplication.

It would be helpful if you can share a minimal project that can reproduce this issue.

@mik9
Copy link
Author

mik9 commented Mar 24, 2018

My newApplication method looks like next (TestApp class that extends App class from main module):

    @Override
    public Application newApplication(ClassLoader cl, String className, Context context) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
        DexOpener.builder(context)
                .buildConfig(BuildConfig.class)
                .build()
                .installTo(cl);
        return super.newApplication(cl, TestApp.class.getName(), context);
    }

I will try to setup simple project with this issue.

@tmurakami
Copy link
Owner

Don't call TestApp.class.getName() on newApplication().
Instead, use a string literal of the Application class name.

return super.newApplication(cl, "your.app.test.TestApp", context);

@mik9
Copy link
Author

mik9 commented Mar 24, 2018

Tried using raw string: still same exception.

Currently can't identify what of my code cause this to setup minimal project... The only thing I see that: this classes was generated by Dagger (subcomponent builders).

@mik9
Copy link
Author

mik9 commented Mar 24, 2018

Also I use multidex for debug builds, but as I see, all this classes in exception located in a single dex...

@RocketRider
Copy link

Just found the corresponding issue in the google bug tracker, if anyone is interested.
https://issuetracker.google.com/issues/75295983

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants