简体   繁体   中英

java.lang.AbstractMethodError: abstract method not implemented

I am currently porting a Android app to my phone and have made good progress. I have an error currently however and I have no idea what is wrong:

06 21:05:24.301 E/AndroidRuntime(2871): java.lang.AbstractMethodError: abstract method not implemented 04-06 21:05:24.301 E/AndroidRuntime(2871): at android.content.pm.PackageManager.getInstalledThemePackages(PackageManager.java) 04-06 21:05:24.301 E/AndroidRuntime(2871): at com.tmobile.thememanager.provider.ThemesProvider$VerifyInstalledThemesThread.verifyPackages(ThemesProvider.java:291) 04-06 21:05:24.301 E/AndroidRuntime(2871): at com.tmobile.thememanager.provider.ThemesProvider$VerifyInstalledThemesThread.run(ThemesProvider.java:230)

This is taken from a logcat by the way.

Here is the code of that Java file: Click Me

It is possible that you are making your code compatible with an older version of the Android API and that now a recent version has additional methods which would need to be implemented in order for it to run in recent versions.

I'm not sure if this is your problem, but assuming it is what is happening, you can load classes based on SDK version, as explained in this other post from Stack Overflow: android compability problem

I had a similar problem when using retrofit and OKHttp . In my case I had to change the following:

  • compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
  • compile 'com.squareup.okhttp3:logging-interceptor: 3.3.1 '

to:

  • compile 'com.squareup.okhttp3:okhttp:3.0.0-RC1'
  • compile 'com.squareup.okhttp3:logging-interceptor: 3.0.0-RC1 '

it helped me to avoid the error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM