[
https://issues.apache.org/jira/browse/ODFTOOLKIT-459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16092543#comment-16092543
]
Herman Tse commented on ODFTOOLKIT-459:
---------------------------------------
Hi Savnte,
I'm building an Android app which read a .odt file to obtain the text inside to
display in the app. You can locate my apps in Google Play searching
hermanandroid.
I've followed your provided link and download the
simple-odf-0.8.2-incubating-jar-with-dependencies.jar and put it into the
'libs' folder and remove the other four jar files. However, I still received
error message when running the app (by connecting my Android mobile directly
without any virtual device) as below:
:android:transformClassesWithDexForDebug
AGPBI: {"kind":"error","text":"trouble processing
\"javax/xml/XMLConstants.class\":","sources":[{}]}
AGPBI: {"kind":"error","text":"Ill-advised or mistaken usage of a core class
(java.* or javax.*)","sources":[{}]}
AGPBI: {"kind":"error","text":"when not building a core
library.","sources":[{}]}
AGPBI: {"kind":"error","text":"This is often due to inadvertently including a
core library file","sources":[{}]}
AGPBI: {"kind":"error","text":"in your application\u0027s project, when using
an IDE (such as","sources":[{}]}
AGPBI: {"kind":"error","text":"Eclipse). If you are sure you\u0027re not
intentionally defining a","sources":[{}]}
AGPBI: {"kind":"error","text":"core class, then this is the most likely
explanation of what\u0027s","sources":[{}]}
AGPBI: {"kind":"error","text":"going on.","sources":[{}]}
AGPBI: {"kind":"error","text":"However, you might actually be trying to define
a class in a core","sources":[{}]}
AGPBI: {"kind":"error","text":"namespace, the source of which you may have
taken, for example,","sources":[{}]}
AGPBI: {"kind":"error","text":"from a non-Android virtual machine project. This
will most","sources":[{}]}
AGPBI: {"kind":"error","text":"assuredly not work. At a minimum, it jeopardizes
the","sources":[{}]}
AGPBI: {"kind":"error","text":"compatibility of your app with future versions
of the platform.","sources":[{}]}
AGPBI: {"kind":"error","text":"It is also often of questionable
legality.","sources":[{}]}
AGPBI: {"kind":"error","text":"If you really intend to build a core library --
which is only","sources":[{}]}
AGPBI: {"kind":"error","text":"appropriate as part of creating a full virtual
machine","sources":[{}]}
AGPBI: {"kind":"error","text":"distribution, as opposed to compiling an
application -- then use","sources":[{}]}
AGPBI: {"kind":"error","text":"the \"--core-library\" option to suppress this
error message.","sources":[{}]}
AGPBI: {"kind":"error","text":"If you go ahead and use \"--core-library\" but
are in fact","sources":[{}]}
AGPBI: {"kind":"error","text":"building an application, then be forewarned that
your application","sources":[{}]}
AGPBI: {"kind":"error","text":"will still fail to build or run, at some point.
Please be","sources":[{}]}
AGPBI: {"kind":"error","text":"prepared for angry customers who find, for
example, that your","sources":[{}]}
AGPBI: {"kind":"error","text":"application ceases to function once they upgrade
their operating","sources":[{}]}
AGPBI: {"kind":"error","text":"system. You will be to blame for this
problem.","sources":[{}]}
AGPBI: {"kind":"error","text":"If you are legitimately using some code that
happens to be in a","sources":[{}]}
AGPBI: {"kind":"error","text":"core package, then the easiest safe alternative
you have is to","sources":[{}]}
AGPBI: {"kind":"error","text":"repackage that code. That is, move the classes
in question into","sources":[{}]}
AGPBI: {"kind":"error","text":"your own package namespace. This means that they
will never be in","sources":[{}]}
AGPBI: {"kind":"error","text":"conflict with core system classes. JarJar is a
tool that may help","sources":[{}]}
AGPBI: {"kind":"error","text":"you in this endeavor. If you find that you
cannot do this, then","sources":[{}]}
AGPBI: {"kind":"error","text":"that is an indication that the path you are on
will ultimately","sources":[{}]}
AGPBI: {"kind":"error","text":"lead to pain, suffering, grief, and
lamentation.","sources":[{}]}
AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]}
FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':android:transformClassesWithDexForDebug'.
> com.android.build.api.transform.TransformException:
> java.lang.RuntimeException: com.android.ide.common.process.ProcessException:
> java.util.concurrent.ExecutionException:
> com.android.ide.common.process.ProcessException: Return code 1 for dex process
Any idea what went wrong? Please find part of my code referring to odf below:
public void readTxt(InputStream inStrm) {
try {
TextDocument textDoc =
(TextDocument)TextDocument.loadDocument(inStrm);
String output = textDoc.getContentRoot().toString();
myLogger.debug("readTxt: " + output);
} catch (Exception e) {
e.printStackTrace();
}
}
Thanks again for your help.
> Updating Simple API getting started guide description and dependencies
> ----------------------------------------------------------------------
>
> Key: ODFTOOLKIT-459
> URL: https://issues.apache.org/jira/browse/ODFTOOLKIT-459
> Project: ODF Toolkit
> Issue Type: Bug
> Components: simple api
> Affects Versions: 0.6-incubating
> Environment: Mac OS 10.11.6
> Android Studio 2.3.3
> Reporter: Herman Tse
> Assignee: Svante Schubert
> Fix For: 0.6.2-incubating
>
>
> Followed instructions on
> http://incubator.apache.org/odftoolkit/simple/gettingstartguide.html
> and included :
> simple-odf-0.6.6.jar
> odfdom-java-0.8.7.jar
> xercesImpl-2.9.1.jar
> xml-apis-1.3.04.jar
> in 'libs' folder and classpath for compilation.
> build.gradle(android):
> android {
> buildToolsVersion "25.0.0"
> compileSdkVersion 25
> sourceSets {
> main {
> manifest.srcFile 'AndroidManifest.xml'
> java.srcDirs = ['src']
> aidl.srcDirs = ['src']
> renderscript.srcDirs = ['src']
> res.srcDirs = ['res']
> assets.srcDirs = ['assets']
> jniLibs.srcDirs = ['libs']
> }
> instrumentTest.setRoot('tests')
> }
> packagingOptions {
> exclude 'META-INF/robovm/ios/robovm.xml'
> }
> defaultConfig {
> applicationId "com.hermantseproduction.htmonkey"
> minSdkVersion 14
> targetSdkVersion 25
> versionName "1.0"
> versionCode 1
> }
> }
> ends up with error when run:
> AGPBI: {"kind":"error","text":"Error converting bytecode to dex:\nCause:
> java.lang.RuntimeException: Exception parsing
> classes","sources":[{}],"original":"UNEXPECTED TOP-LEVEL
> EXCEPTION:\njava.lang.RuntimeException: Exception parsing classes\n\tat
> com.android.dx.command.dexer.Main.processClass(Main.java:781)\n\tat
> com.android.dx.command.dexer.Main.processFileBytes(Main.java:747)\n\tat
> com.android.dx.command.dexer.Main.access$1200(Main.java:88)\n\tat
> com.android.dx.command.dexer.Main$FileBytesConsumer.processFileBytes(Main.java:1689)\n\tat
>
> com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)\n\tat
>
> com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)\n\tat
>
> com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)\n\tat
> com.android.dx.command.dexer.Main.processOne(Main.java:695)\n\tat
> com.android.dx.command.dexer.Main.processAllFiles(Main.java:592)\n\tat
> com.android.dx.command.dexer.Main.runMonoDex(Main.java:321)\n\tat
> com.android.dx.command.dexer.Main.run(Main.java:292)\n\tat
> com.android.builder.internal.compiler.DexWrapper.run(DexWrapper.java:54)\n\tat
>
> com.android.builder.core.DexByteCodeConverter.lambda$dexInProcess$0(DexByteCodeConverter.java:174)\n\tat
> java.util.concurrent.FutureTask.run(FutureTask.java:266)\n\tat
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n\tat
>
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n\tat
> java.lang.Thread.run(Thread.java:745)\nCaused by:
> com.android.dx.cf.iface.ParseException: bad utf-8 byte a0 at offset
> 00000004\n\tat
> com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:374)\n\tat
>
> com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:262)\n\tat
>
> com.android.dx.cf.cst.ConstantPoolParser.parse0(ConstantPoolParser.java:294)\n\tat
>
> com.android.dx.cf.cst.ConstantPoolParser.parse(ConstantPoolParser.java:150)\n\tat
>
> com.android.dx.cf.cst.ConstantPoolParser.parseIfNecessary(ConstantPoolParser.java:124)\n\tat
>
> com.android.dx.cf.cst.ConstantPoolParser.getPool(ConstantPoolParser.java:115)\n\tat
>
> com.android.dx.cf.direct.DirectClassFile.parse0(DirectClassFile.java:482)\n\tat
>
> com.android.dx.cf.direct.DirectClassFile.parse(DirectClassFile.java:406)\n\tat
>
> com.android.dx.cf.direct.DirectClassFile.parseToInterfacesIfNecessary(DirectClassFile.java:388)\n\tat
>
> com.android.dx.cf.direct.DirectClassFile.getMagic(DirectClassFile.java:251)\n\tat
> com.android.dx.command.dexer.Main.parseClass(Main.java:793)\n\tat
> com.android.dx.command.dexer.Main.access$1600(Main.java:88)\n\tat
> com.android.dx.command.dexer.Main$ClassParserTask.call(Main.java:1728)\n\tat
> com.android.dx.command.dexer.Main.processClass(Main.java:779)\n\t... 16
> more\nCaused by: java.lang.IllegalArgumentException: bad utf-8 byte a0 at
> offset 00000004\n\tat
> com.android.dx.rop.cst.CstString.throwBadUtf8(CstString.java:172)\n\tat
> com.android.dx.rop.cst.CstString.utf8BytesToString(CstString.java:143)\n\tat
> com.android.dx.rop.cst.CstString.\u003cinit\u003e(CstString.java:200)\n\tat
> com.android.dx.cf.cst.ConstantPoolParser.parseUtf8(ConstantPoolParser.java:371)\n\t...
> 29 more\n","tool":"Dex"}
> AGPBI: {"kind":"error","text":"1 error; aborting","sources":[{}]}
> FAILURE: Build failed with an exception.
> * What went wrong:
> Execution failed for task ':android:transformClassesWithDexForDebug'.
> > com.android.build.api.transform.TransformException:
> > java.lang.RuntimeException:
> > com.android.ide.common.process.ProcessException:
> > java.util.concurrent.ExecutionException:
> > com.android.ide.common.process.ProcessException: Return code 1 for dex
> > process
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)