2016-08-17 6 views
1

申し訳ありませんが悪い英語のために、私はアンドロイドスタジオのより新しい開発者です。android用CSSパーサー

最近、私はアンドロイドアプリケーションで動作するライブラリを検索しようとしています。

私は2つのライブラリ、CSS Parserph-cssを研究しました。

これらのライブラリは依存関係を扱うためにmavenリポジトリを使用しました。

CSSパーサ - 私はCSSパーサのWebページに表示例と、このページ(stackoverflow.com/questions/1513587/looking-for-a-css-parser-in-java)をコピーしようとしましたが、いくつかのクラスは存在しません。例:CSSRule。考え出しへ 、私はEclipseでプロジェクトを作成し、私が使用するライブラリが見つかりました:これにより

import org.w3c.dom.css.CSSRule; 
import org.w3c.dom.css.CSSRuleList; 
import org.w3c.dom.css.CSSStyleRule; 

を、私はMavenのリポジトリにこれらのライブラリを検索すると、私はページを発見(mvnrepository.com/artifact/xml -apis/xml-apis/1.4.01)(XML-APIS)。すべてのエラーは消えましたが、コンパイルするとこのエラーが表示されます。

Error:trouble processing "javax/xml/XMLConstants.class": 

Ill-advised or mistaken usage of a core class (java.* or javax.*) 
when not building a core library. 

This is often due to inadvertently including a core library file 
in your application's project, when using an IDE (such as 
Eclipse). If you are sure you're not intentionally defining a 
core class, then this is the most likely explanation of what's 
going on. 

However, you might actually be trying to define a class in a core 
namespace, the source of which you may have taken, for example, 
from a non-Android virtual machine project. This will most 
assuredly not work. At a minimum, it jeopardizes the 
compatibility of your app with future versions of the platform. 
It is also often of questionable legality. 

If you really intend to build a core library -- which is only 
appropriate as part of creating a full virtual machine 
distribution, as opposed to compiling an application -- then use 
the "--core-library" option to suppress this error message. 

If you go ahead and use "--core-library" but are in fact 
building an application, then be forewarned that your application 
will still fail to build or run, at some point. Please be 
prepared for angry customers who find, for example, that your 
application ceases to function once they upgrade their operating 
system. You will be to blame for this problem. 

If you are legitimately using some code that happens to be in a 
core package, then the easiest safe alternative you have is to 
repackage that code. That is, move the classes in question into 
your own package namespace. This means that they will never be in 
conflict with core system classes. JarJar is a tool that may help 
you in this endeavor. If you find that you cannot do this, then 
that is an indication that the path you are on will ultimately 
lead to pain, suffering, grief, and lamentation. 

ph-CSS - 私は同じプロセスを使用して、mavenリポジトリをgradleに入れて実行しました。もう一つは、それがこのメッセージが表示され、失敗しました:

Error:PARSE ERROR: 
Error:unsupported class file version 52.0 
Error:...while parsing com/helger/commons/CGlobal.class 
Error:1 error; aborting 
:app:transformClassesWithDexForDebug FAILED 
Error:Execution failed for task ':app: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: org.gradle.process.internal.ExecException: Process 'command 'C:\Program Files\Java\jdk1.8.0_65\bin\java.exe'' finished with non-zero exit value 1 

は、私は、このページを使用しようとしましたが(stackoverflow.com/questions/37902840/got-unsupported-class-file-version-52-0-after-including-a -moduleツー・プロジェクト)stackoverflowの中

何も... を起こりませんし、私は、JDK 8について、著者の変更履歴を見たとき、私はこの(developer.android.com/preview/j8-を使用しようとしましたjack.html?hl = en)代わりに:

私は重複したファイルを削除し、メッセージの表示:

Error:Library reading phase: Type javax.annotation.Untainted from file 'C:\Users\user\AndroidStudioProjects\CSSTest\app\build\intermediates\jill\debug\packaged\jsr305-3.0.1-dd0e9f5d0efb3025f6fde4238fd4a5c268f62a63.jar' has already been imported from file 'C:\Users\user\AndroidStudioProjects\CSSTest\app\build\intermediates\jill\debug\packaged\annotations-3.0.1u2-2b84c751906484cab0381cba276af74c2923d73b.jar', type 'javax.annotation.Untainted' (see property 'jack.import.type.policy' for type collision policy) 
com.android.jack.api.v01.CompilationException: Library reading phase: Type javax.annotation.Untainted from file 'C:\Users\user\AndroidStudioProjects\CSSTest\app\build\intermediates\jill\debug\packaged\jsr305-3.0.1-dd0e9f5d0efb3025f6fde4238fd4a5c268f62a63.jar' has already been imported from file 'C:\Users\user\AndroidStudioProjects\CSSTest\app\build\intermediates\jill\debug\packaged\annotations-3.0.1u2-2b84c751906484cab0381cba276af74c2923d73b.jar', type 'javax.annotation.Untainted' (see property 'jack.import.type.policy' for type collision policy) 

今、私はこれを解決する手がかりがありません。任意のヒント?

申し訳ありませんが、私は評判要件がないので、ハイパーリンクを含めませんでした。

答えて

0

Androidは、最新バージョンのph-css(jdk 8でコンパイルされています)を使用している場合、サポートされていないクラスファイルバージョン52-0エラーが発生するため、jdk 8のすべての機能をサポートしていません。しかし、これをbuild.gradleファイルに追加することで、jdk 6/7に対して最後にコンパイルされたバージョン4.1.4を使用することができます。

dependencies { 
    compile 'com.helger:ph-css:4.1.4' 
} 
関連する問題