关于利用POI在Android 上直接编辑word模板出错问题。

从零单排 2017-11-23 08:04:55
想做一个在安卓上输入内容,直接生成相应模板的word文档。在利用POI时出现错误,avd可以跑,但一装到手机就出问题。报错新
11-23 19:59:25.593 25376-25376/? E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.hcr.health.trywit, PID: 25376
java.lang.NoClassDefFoundError: Failed resolution of: Lorg/apache/commons/collections4/bidimap/TreeBidiMap;
at org.apache.poi.hpsf.Section.<init>(Section.java:178)
at org.apache.poi.hpsf.MutableSection.<init>(MutableSection.java:41)
at org.apache.poi.hpsf.PropertySet.init(PropertySet.java:494)
at org.apache.poi.hpsf.PropertySet.<init>(PropertySet.java:196)
at org.apache.poi.hpsf.MutablePropertySet.<init>(MutablePropertySet.java:44)
at org.apache.poi.hpsf.SpecialPropertySet.<init>(SpecialPropertySet.java:47)
at org.apache.poi.hpsf.DocumentSummaryInformation.<init>(DocumentSummaryInformation.java:99)
at org.apache.poi.hpsf.PropertySetFactory.create(PropertySetFactory.java:116)
at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:236)
at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:197)
at org.apache.poi.POIDocument.readPropertySet(POIDocument.java:175)
at org.apache.poi.POIDocument.readProperties(POIDocument.java:158)
at org.apache.poi.hwpf.HWPFDocumentCore.updateEncryptionInfo(HWPFDocumentCore.java:282)
at org.apache.poi.hwpf.HWPFDocument.write(HWPFDocument.java:644)
at org.apache.poi.hwpf.HWPFDocument.write(HWPFDocument.java:619)
at com.hcr.health.trywit.Ass.writeDoc(Ass.java:108)
at com.hcr.health.trywit.Ass.printer(Ass.java:87)
at com.hcr.health.trywit.Ass.onCreate(Ass.java:28)
at android.app.Activity.performCreate(Activity.java:6684)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2652)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1507)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6236)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781)
Caused by: java.lang.ClassNotFoundException: Didn't find class "org.apache.commons.collections4.bidimap.TreeBidiMap" on path: DexPathList[[zip file "/data/app/com.hcr.health.trywit-2/base.apk"],nativeLibraryDirectories=[/data/app/com.hcr.health.trywit-2/lib/arm, /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)
at org.apache.poi.hpsf.Section.<init>(Section.java:178) 
at org.apache.poi.hpsf.MutableSection.<init>(MutableSection.java:41) 
at org.apache.poi.hpsf.PropertySet.init(PropertySet.java:494) 
at org.apache.poi.hpsf.PropertySet.<init>(PropertySet.java:196) 
at org.apache.poi.hpsf.MutablePropertySet.<init>(MutablePropertySet.java:44) 
at org.apache.poi.hpsf.SpecialPropertySet.<init>(SpecialPropertySet.java:47) 
at org.apache.poi.hpsf.DocumentSummaryInformation.<init>(DocumentSummaryInformation.java:99) 
at org.apache.poi.hpsf.PropertySetFactory.create(PropertySetFactory.java:116) 
at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:236) 
at org.apache.poi.POIDocument.getPropertySet(POIDocument.java:197) 
at org.apache.poi.POIDocument.readPropertySet(POIDocument.java:175) 
at org.apache.poi.POIDocument.readProperties(POIDocument.java:158) 
at org.apache.poi.hwpf.HWPFDocumentCore.updateEncryptionInfo(HWPFDocumentCore.java:282) 
at org.apache.poi.hwpf.HWPFDocument.write(HWPFDocument.java:644) 
at org.apache.poi.hwpf.HWPFDocument.write(HWPFDocument.java:619) 
at com.hcr.health.trywit.Ass.writeDoc(Ass.java:108) 
at com.hcr.health.trywit.Ass.printer(Ass.java:87) 
at com.hcr.health.trywit.Ass.onCreate(Ass.java:28) 
at android.app.Activity.performCreate(Activity.java:6684) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2652) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2766) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1507) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6236) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:891) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:781) 



请教一下各位!
...全文
405 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
romanticaccount 2018-04-24
  • 打赏
  • 举报
回复
不建议使用POI,很多java上关于图像的包,andriod是没有的。 可以用libreoffice, android 开源版。

80,472

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧