- Во-первых, я использовал Android Studio 2.3 Beta 2 создать новый проект с Navigation Выдвижные активность шаблона.
В content_main.xml файла:Ошибка: java.lang.IllegalArgumentException: Неожиданный тип тега 67 найден
<?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>
Был ошибка:
Cannot resolve symbol 'parent'
ПОЛНЫЙ 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
В чем проблема с символом «родительский»?
- Sencond, меняю ConstraintLayout к Framelayout
В content_main.xml файла:
<?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>
В процессе BUILD, несмотря на ошибку ниже (вторая линия), 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 пришел.
Кто-нибудь может мне помочь? Благодаря!
Вы можете указать полную ошибку – Redman
можете ли вы показать номер строки вашего xml's – Noorul
Ваш код работает нормально для меня. Вы уверены, что скопировали свой код правильно? – Divers