【问题标题】:Rendering Problems NOTE: This project contains Java compilation errors渲染问题注意:此项目包含 Java 编译错误
【发布时间】:2017-07-22 20:43:10
【问题描述】:

我在 Android Studio 上收到此错误。

渲染问题 注意:此项目包含 Java 编译错误,这可能导致自定义视图的渲染失败。首先修复编译问题。 找不到以下类:

<com.makeuprewardz.app.ui.view.BottomBar (Fix Build Path, Edit XML, Create Class)

提示:尝试构建项目。

这是我的 XML 文件

 <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:fancy="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:orientation="vertical">

<FrameLayout
    android:id="@+id/fl_container"
    android:layout_marginBottom="@dimen/bottombar_height"
    android:layout_width="match_parent"
    android:layout_height="match_parent"/>

<ImageView
    android:layout_width="match_parent"
    android:background="@drawable/actionbar_shadow_up"
    android:layout_gravity="bottom"
    android:layout_marginBottom="@dimen/bottombar_height"
    android:layout_height="wrap_content"
    tools:ignore="ContentDescription" />

<com.makeuprewardz.app.ui.view.BottomBar
    android:id="@+id/bottomBar"
    android:layout_width="match_parent"
    android:layout_height="@dimen/bottombar_height"
    android:layout_gravity="bottom" />

【问题讨论】:

    标签: android rendering


    【解决方案1】:

    确保您在项目的 gradle 文件中添加了自定义视图的依赖项。

    【讨论】:

    • 我该怎么做?
    • 似乎您正在为 BottomBar (com.makeuprewardz.app.ui.view.BottomBar) 使用第三方库。为此,您需要将其库添加到您的 gradle 文件(在您的项目中)。例如编译'com.android.support:appcompat-v7:25.3.0'
    • 我的 gradle 文件中有 'com.android.support:appcompat-v7:25.3.1'
    • 这只是一个示例,展示了如何在 build.gradle 中添加依赖项。您需要添加的是“com.makeuprewardz.app.ui.view.BottomBar”的依赖项。您是否从某个地方复制了代码?
    • 让我简化一下。您得到的错误是 bcoz 编译器无法识别您的类“com.makeuprewardz.app.ui.view.BottomBar”。在这种情况下,有两种可能性。您正在使用定义了此自定义类的 3rd 方库,或者此自定义类是在您的项目本身中定义的。如果它是第 3 方库,请让您的提供者告诉库名称和版本,并将其添加到 gradle 中,如“编译 :”并重新同步项目。如果这个自定义类是在你的项目本身中定义的,那么在位置 com.makeuprewardz.app.ui.view 定义它。我希望它澄清。
    猜你喜欢
    • 2015-10-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-13
    • 1970-01-01
    相关资源
    最近更新 更多