2017-01-16 8 views
2
  • 먼저 발견했다. content_main.xml 파일에서

:오류 : java.lang.IllegalArgumentException가 : 예기치 않은 유형의 태그 (67)는 내가 <strong>탐색 서랍 활동</strong> 템플릿 새 프로젝트를 만들 <strong>안드로이드 스튜디오 2.3 베타 2</strong>을 사용

Cannot resolve symbol 'parent' 

FULL LOG :

Information:Gradle tasks [:app:assembleDebug] 
D:\WORKGROUP\WORKSPACES\Android_Studio_WORKSPACE\Event\app\src\main\res\layout\content_main.xml 
Error:(16, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent'). 
Error:(17, 45) String types not allowed (at 'layout_constraintLeft_toLeftOf' with value 'parent'). 
Error:(18, 47) String types not allowed (at 'layout_constraintRight_toRightOf' with value 'parent'). 
Error:(19, 43) String types not allowed (at 'layout_constraintTop_toTopOf' with value 'parent'). 
D:\WORKGROUP\WORKSPACES\Android_Studio_WORKSPACE\Event\app\build\intermediates\res\merged\debug\layout\content_main.xml 
Error:(16, 49) String types not allowed (at 'layout_constraintBottom_toBottomOf' with value 'parent'). 
Error:(17, 45) String types not allowed (at 'layout_constraintLeft_toLeftOf' with value 'parent'). 
Error:(18, 47) String types not allowed (at 'layout_constraintRight_toRightOf' with value 'parent'). 
Error:(19, 43) String types not allowed (at 'layout_constraintTop_toTopOf' with value 'parent'). 
Error:Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: Failed to execute aapt 
Information:BUILD FAILED 
Information:Total time: 1.786 secs 
Information:9 errors 
Information:0 warnings 
Information:See complete output in console 
오류가 발생했습니다

enter image description here

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/app_bar_main" 
    tools:context="com.waylanpunch.event.MainActivity"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="Hello World!" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" /> 

</android.support.constraint.ConstraintLayout> 

기호 '부모'의 문제점은 무엇입니까? 2 (아래의 오류에도 불구하고, BUILD의 과정

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/app_bar_main" 
    tools:context="com.waylanpunch.event.MainActivity"> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:text="Hello World!" /> 

</FrameLayout> 

:

  • Sencond, 나는 ConstraintLayout이 content_main.xml 파일에서

을 FrameLayout이로 변경 라인), BUILD이 성공했습니다.

Information:Gradle tasks [:app:generateDebugSources,:app:generateDebugAndroidTestSources, :app:mockableAndroidJar, :app:prepareDebugUnitTestDependencies] 
Error:java.lang.IllegalArgumentException: Unexpected type tag 67 found. 
Information:BUILD SUCCESSFUL 
Information:Total time: 2.523 secs 
Information:1 error 
Information:0 warnings 
Information:See complete output in console 

그리고 는 IllegalArgumentException 문제가 어디에서 왔는지 나는 알지 못했다.

누구든지 나를 도와 줄 수 있습니까? 감사!

+0

전체 오류 게시 가능 – Redman

+0

xml의 줄 번호를 표시 할 수 있습니까 – Noorul

+0

코드가 제대로 작동합니다. 코드를 올바르게 복사 했습니까? – Divers

답변

3

이전 버전의 ConstraintLayout을 사용하고 계신 것 같습니다. 최근 버전 인 베타 4 이상을 사용해야합니다 (constraintlayout alpha 5 ...에서 부모 태그 지원을 도입했습니다).

+0

** 1.0.0-alpha4 **는 ** ConstraintLayout **의 최신 버전이며, https://bintray.com/ligboy/를 확인하십시오. maven/constraint-layout –

+0

글쎄 :-) 알파 4가 ConstraintLayout의 최신 버전이 아니라는 것을 확신 할 수 있습니다. http://tools.android.com/recent/constraintlayoutbeta4isnowavailable을 확인하십시오. bintray가 아닌 SDK 관리자로부터 공식 버전을 받아야합니다. 누가 그랬는지 모르겠습니다. –

+0

아, 그래, 누군가가 그걸 만들었지 만, 처음에는 그의 도서관을 참고 했어. 그게 이상해. 나는 그것을 업데이트하고 다시 시도 할 것이다. Thanks @ Nicolas Roard –