專案除錯成功,但是打包以後安裝出錯
阿新 • • 發佈:2018-11-12
工具:Eclipse
今天修改一個專案後,除錯的時候沒有出現任何問題,但是當打包簽名以後,匯出apk安裝到手機就出現閃退,程式報錯:
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mimi7031/org.sipphone.LinphoneLauncherActivity}: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class com.facebook.drawee.view.SimpleDraweeView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2768)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1515 )
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6252)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895 )
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:785)
Caused by: android.view.InflateException: Binary XML file line #23: Binary XML file line #23: Error inflating class com.facebook.drawee.view.SimpleDraweeView
Caused by: android.view.InflateException: Binary XML file line #23: Error inflating class com.facebook.drawee.view.SimpleDraweeView
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance0(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:430)
at android.view.LayoutInflater.createView(LayoutInflater.java:652)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:812)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:752)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:886)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:846)
at android.view.LayoutInflater.inflate(LayoutInflater.java:522)
at android.view.LayoutInflater.inflate(LayoutInflater.java:430)
at android.view.LayoutInflater.inflate(LayoutInflater.java:377)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:412)
at android.app.Activity.setContentView(Activity.java:2433)
at org.sipphone.LinphoneLauncherActivity.onCreate(LinphoneLauncherActivity.java:202)
at android.app.Activity.performCreate(Activity.java:6751)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2660)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2768)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1515)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:160)
at android.app.ActivityThread.main(ActivityThread.java:6252)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:895)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:785)
Caused by: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/facebook/drawee/R$styleable;
at com.facebook.drawee.view.GenericDraweeView.inflateHierarchy(GenericDraweeView.java:127)
at com.facebook.drawee.view.GenericDraweeView.<init>(GenericDraweeView.java:75)
at com.facebook.drawee.view.SimpleDraweeView.<init>(SimpleDraweeView.java:60)
... 27 more
Caused by: java.lang.ClassNotFoundException: Didn't find class "com.facebook.drawee.R$styleable" on path: DexPathList[[zip file "/data/app/com.mimi7031-2/base.apk"],nativeLibraryDirectories=[/data/app/com.mimi7031-2/lib/arm, /system/fake-libs, /data/app/com.mimi7031-2/base.apk!/lib/armeabi-v7a, /system/lib, /vendor/lib]]
at dalvik.system.BaseDexClassLoader.findClass(BaseDexClassLoader.java:56)
at java.lang.ClassLoader.loadClass(ClassLoader.java:380)
at java.lang.ClassLoader.loadClass(ClassLoader.java:312)
... 30 more
上網搜了很久,找到了這篇文章http://blog.csdn.net/ocean20/article/details/40855647
得到了啟發,因為在打包之前,我匯入了另一個專案,可能是在匯出apk的時候,編譯和匯出出現了衝突,導致了程式出錯,我把新匯入的專案刪掉以後,再重新匯出apk,問題解決,記錄一下。