Prolem使用urbanairship Provider android

我正在使用urbanairship来显示通知。 我已经更新了我的Android SDK到最新的更新,它开始显示与urbanairship提供者相关的错误,并且与旧版本一起工作正常。

05-22 17:54:30.476: E/AndroidRuntime(575): FATAL EXCEPTION: main 05-22 17:54:30.476: E/AndroidRuntime(575): java.lang.RuntimeException: Unable to get provider com.urbanairship.UrbanAirshipProvider: java.lang.ClassNotFoundException: com.urbanairship.UrbanAirshipProvider 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.installProvider(ActivityThread.java:4289) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.installContentProviders(ActivityThread.java:4041) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3995) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.access$1300(ActivityThread.java:127) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1217) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.os.Handler.dispatchMessage(Handler.java:99) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.main(ActivityThread.java:4508) 05-22 17:54:30.476: E/AndroidRuntime(575): at java.lang.reflect.Method.invokeNative(Native Method) 05-22 17:54:30.476: E/AndroidRuntime(575): at java.lang.reflect.Method.invoke(Method.java:511) 05-22 17:54:30.476: E/AndroidRuntime(575): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:809) 05-22 17:54:30.476: E/AndroidRuntime(575): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:576) 05-22 17:54:30.476: E/AndroidRuntime(575): at dalvik.system.NativeStart.main(Native Method) 05-22 17:54:30.476: E/AndroidRuntime(575): Caused by: java.lang.ClassNotFoundException: com.urbanairship.UrbanAirshipProvider 05-22 17:54:30.476: E/AndroidRuntime(575): at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:61) 05-22 17:54:30.476: E/AndroidRuntime(575): at java.lang.ClassLoader.loadClass(ClassLoader.java:501) 05-22 17:54:30.476: E/AndroidRuntime(575): at java.lang.ClassLoader.loadClass(ClassLoader.java:461) 05-22 17:54:30.476: E/AndroidRuntime(575): at android.app.ActivityThread.installProvider(ActivityThread.java:4274) 05-22 17:54:30.476: E/AndroidRuntime(575): ... 12 more 

我在我的项目中使用urbanairship-lib-2.1.4.jar。 有没有兼容性问题或什么?

Yey! 刚刚find了解决scheme! 问题出在最新更新推出的Android Private Libraries 。 出于某种原因,默认情况下,他们在项目属性中打勾。

只需转到Project -> Properties -> Java Build Path -> Order and Export并检查Android Private Libraries 。 这解决了我的问题。