Reputation: 5767
I have an android library project where I use android 2.3 private API. I have the main android 4.2 project that uses this library project. I need to run this project on android 4.2 device. (android 4.2 doesn't have this api available in android 2.3) And every time I get the runtime exception:
AndroidRuntime(1395): java.lang.NoSuchMethodError: android.content.pm.IPackageManager.getPackageInfo
It's clear why I get it; but does it possible to resolve this problem?
Upvotes: 0
Views: 138
Reputation: 3497
Since getPackageInfo is API that added in level 1, it sounds weird.
See link : http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageInfo(java.lang.String, int)
Does Context (Activity, ApplicationContext, etc) was properly set?
because getPackageInfo() usually used like below,
context.getPackageManager().getPackageInfo
So if context or packageManager is wrong, getPackageInfo cannot be called.
Just Refresh - Clean and do it again. Sometimes it works.
Definitely, There exists getPackageInfo() in Android 4.2. (Actually, 2.2 ~ 4.3) It seems that android works fine.
Upvotes: 1