2016-08-17 3 views
1

죄송합니다. 영어로 작성하지 않아서, 안드로이드 스튜디오의 최신 개발자입니다.안드로이드 용 CSS 파서

요즘은 내 안드로이드 응용 프로그램에서 작동하는 라이브러리를 검색하려고합니다.

두 라이브러리, CSS Parserph-css을 조사했습니다.

이 라이브러리들은 종속성을 다루기 위해 maven 리포지토리를 사용했습니다.

CSS 파서 - 나는 CSS 파서 웹 페이지에 표시 예제이 페이지 (stackoverflow.com/questions/1513587/looking-for-a-css-parser-in-java)을 복사하려고했으나 일부 클래스가 존재하지 않습니다. 예 : CSSRule. 파악에 , 내가 이클립스에서 프로젝트를 생성 내가 사용하는 라이브러리를 발견 :이

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

을, 내가 받는다는 저장소에서이 라이브러리를 검색하고 내가 페이지를 발견 (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 - 동일한 프로세스를 사용하여 메이븐 저장소를 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 - 투 - A-프로젝트에 유래에서) 내가 JDK 8에 대한 저자의 변경 로그를봤을 때, 난이 (developer.android.com/preview/j8-를 사용하려고

아무런 변화가 없습니다 ... 그리고 jack.html? hl = ko) 대신

중복 파일을 삭제하고 님의 메시지는 다음과 같습니다 :

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

안드로이드는 jdk 8의 모든 기능을 지원하지 않기 때문에 최신 버전의 ph-css (jdk 8로 컴파일 됨)를 사용할 때 지원되지 않는 클래스 파일 버전 52-0 오류가 발생합니다. 그러나 build.gradle 파일에이 파일을 추가하여 jdk 6/7에 대해 마지막으로 컴파일 된 버전 4.1.4를 사용할 수 있습니다.

dependencies { 
    compile 'com.helger:ph-css:4.1.4' 
}