Android Studio堆栈跟踪错误

时间:2016-06-01 19:46:57

标签: android android-studio resources stack-trace

我最近刚接触Android开发,我需要帮助找出造成错误的原因。我昨天正在处理我的项目,它运行正常,直到我关闭它并在第二天打开它接收渲染问题,从而阻止我看到预览屏幕。我的堆栈跟踪如下:

android.content.res.Resources$NotFoundException
    at com.android.layoutlib.bridge.android.BridgeContext.obtainStyledAttributes(BridgeContext.java:626)
    at android.content.res.Resources_Theme_Delegate.obtainStyledAttributes(Resources_Theme_Delegate.java:71)
    at android.content.res.Resources$Theme.obtainStyledAttributes(Resources.java:1512)
    at android.widget.TextView.<init>(TextView.java:728)
    at android.widget.TextView.<init>(TextView.java:671)
    at android.widget.TextView.<init>(TextView.java:667)
    at com.android.layoutlib.bridge.MockView.<init>(MockView.java:50)
    at com.android.layoutlib.bridge.MockView.<init>(MockView.java:45)
    at com.android.layoutlib.bridge.MockView.<init>(MockView.java:41)
    at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:163)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:835)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:838)
    at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:70)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:811)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
    at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:229)
    at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:426)
    at com.android.ide.common.rendering.LayoutLibrary.createSession(LayoutLibrary.java:350)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:520)
    at com.android.tools.idea.rendering.RenderTask$2.compute(RenderTask.java:508)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:967)
    at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:508)
    at com.android.tools.idea.rendering.RenderTask.access$600(RenderTask.java:75)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:620)
    at com.android.tools.idea.rendering.RenderTask$3.call(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderService.runRenderAction(RenderService.java:371)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:617)
    at com.android.tools.idea.rendering.RenderTask.render(RenderTask.java:639)
    at com.intellij.android.designer.designSurface.AndroidDesignerEditorPanel$7.run(AndroidDesignerEditorPanel.java:519)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:337)
    at com.intellij.util.ui.update.MergingUpdateQueue.execute(MergingUpdateQueue.java:327)
    at com.intellij.util.ui.update.MergingUpdateQueue$3.run(MergingUpdateQueue.java:271)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:286)
    at com.intellij.util.ui.update.MergingUpdateQueue.flush(MergingUpdateQueue.java:244)
    at com.intellij.util.ui.update.MergingUpdateQueue.run(MergingUpdateQueue.java:234)
    at com.intellij.util.concurrency.QueueProcessor.runSafely(QueueProcessor.java:238)
    at com.intellij.util.Alarm$Request$1.run(Alarm.java:352)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

我在项目中处理过的文件:

activity_sign_in.xml

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:gravity="center_horizontal"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.dominik.agwumd.SignIn"
    android:background="@drawable/background_color">

    <!-- Login progress -->
    <ProgressBar
        android:id="@+id/login_progress"
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="8dp"
        android:visibility="gone" />

    <ImageView
        android:layout_width="305dp"
        android:layout_height="266dp"
        android:id="@+id/imageView2"
        android:contentDescription="@string/agwumd_logo"
        android:src="@drawable/final_agwumd_logo" />

    <LinearLayout
        android:id="@+id/email_login_form"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:weightSum="1"
        android:gravity="bottom|center"
        android:clickable="true">

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <AutoCompleteTextView
                android:id="@+id/email"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/username1"
                android:inputType="textEmailAddress"
                android:maxLines="1"
                android:singleLine="true"
                android:textColor="@color/colorAccent"
                android:textColorHint="@color/colorAccent"
                android:textAppearance="@color/colorAccent"
                android:textColorHighlight="@color/colorAccent"
                android:textColorLink="@color/colorAccent"
                android:text="@string/username" />

        </android.support.design.widget.TextInputLayout>

        <android.support.design.widget.TextInputLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content">

            <EditText
                android:id="@+id/password"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:hint="@string/password"
                android:imeActionId="@+id/login"
                android:imeActionLabel="@string/action_sign_in_short"
                android:imeOptions="actionUnspecified"
                android:inputType="textPassword"
                android:maxLines="1"
                android:singleLine="true"
                android:textColor="@color/colorAccent"
                android:textColorHint="@color/colorAccent"
                android:textColorHighlight="@color/colorAccent"
                android:textColorLink="@color/colorAccent"
                android:textAppearance="@color/colorAccent"
                android:textIsSelectable="true" />

        </android.support.design.widget.TextInputLayout>

        <Button
            android:id="@+id/email_sign_in_button"
            style="?android:textAppearanceSmall"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:text="@string/sign_in"
            android:background="@color/colorAccent"
            android:textColor="#306e50"
            android:textStyle="bold" />

    </LinearLayout>

</LinearLayout>

如果需要任何其他文件的代码,请参阅我的项目菜单:

enter image description here

1 个答案:

答案 0 :(得分:2)

            android:textAppearance="@color/colorAccent"

这两行是我xml中的问题。必须设置错误的值。我以为我会把这篇文章留给其他人。