ClassNotFoundException:twitter4j.conf.PropertyConfigurationFactory:Android

时间:2013-04-08 12:39:42

标签: java android twitter proguard classnotfoundexception

如果我没有在我的项目上运行pro-guard,一切都很好,但是如果我运行pro-guard并在设备中安装.apk,我就会遇到错误。我尝试在proguard-android.txt文件

中添加以下行
-keep public class twitter4j.conf.PropertyConfigurationFactory

-dontwarn twitter4j.**

但它没有任何区别。

我正在使用proguard-android.txt

中的默认SDK文件

并将其设置为project.properties,如下所示

proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt

我查看了同一问题的this链接,但无法理解,谷歌也没有帮助我。

那么,有人可以告诉我这里有什么问题吗?

提前致谢

修改:

删除public限定符后的Logcat错误:

04-18 12:05:25.425: E/AndroidRuntime(16405): FATAL EXCEPTION: main
04-18 12:05:25.425: E/AndroidRuntime(16405): java.lang.ExceptionInInitializerError
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.b.a.h.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.ap.a(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.ap.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.aq.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.al.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.ao.a(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.ao.a(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.mobinius.creativepad.c.f.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.mobinius.creativepad.c.a.<init>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.mobinius.creativepad.android.OpenScreenActivity.e(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.mobinius.creativepad.android.OpenScreenActivity.onClick(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.view.View.performClick(View.java:4232)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.view.View$PerformClick.run(View.java:17298)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.os.Handler.handleCallback(Handler.java:615)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.os.Handler.dispatchMessage(Handler.java:92)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.os.Looper.loop(Looper.java:137)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at android.app.ActivityThread.main(ActivityThread.java:4921)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at java.lang.reflect.Method.invokeNative(Native Method)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at java.lang.reflect.Method.invoke(Method.java:511)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at dalvik.system.NativeStart.main(Native Method)
04-18 12:05:25.425: E/AndroidRuntime(16405): Caused by: java.lang.AssertionError: java.lang.NoSuchMethodException: <init> [interface twitter4j.b.a.d]
04-18 12:05:25.425: E/AndroidRuntime(16405):    at twitter4j.b.a.e.<clinit>(Unknown Source)
04-18 12:05:25.425: E/AndroidRuntime(16405):    ... 22 more
04-18 12:05:25.425: E/AndroidRuntime(16405): Caused by: java.lang.NoSuchMethodException: <init> [interface twitter4j.b.a.d]
04-18 12:05:25.425: E/AndroidRuntime(16405):    at java.lang.Class.getConstructorOrMethod(Class.java:460)
04-18 12:05:25.425: E/AndroidRuntime(16405):    at java.lang.Class.getConstructor(Class.java:431)
04-18 12:05:25.425: E/AndroidRuntime(16405): 

1 个答案:

答案 0 :(得分:5)

该课程不公开,因此您应删除-keep选项中的“public”关键字,否则模板将不匹配。