【问题标题】:Access denied finding property "ro.sf.lcd_density访问被拒绝查找属性“ro.sf.lcd_density
【发布时间】:2019-08-26 07:06:59
【问题描述】:

我的程序运行正常,但编译器中显示此错误。如何解决?

在谷歌上找不到答案,我查了很多次。

activity_main

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/mainLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <!-- username-->
    <com.google.android.material.textfield.TextInputLayout

        android:id="@+id/username_TIL"
        android:layout_width="250dp"
        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"
        android:layout_marginTop="100dp"
        android:elevation="2dp">

        <com.google.android.material.textfield.TextInputEditText

            android:id="@+id/username_TIET"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:hint="@string/username" />

    </com.google.android.material.textfield.TextInputLayout>
    <!-- password-->
    <com.google.android.material.textfield.TextInputLayout

        android:id="@+id/password_TIL"
        android:layout_width="250dp"
        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:layout_below="@id/username_TIL">

        <com.google.android.material.textfield.TextInputEditText

            android:id="@+id/password_TIET"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:hint="password"/>

    </com.google.android.material.textfield.TextInputLayout>
    <!-- confirmPassword-->
    <com.google.android.material.textfield.TextInputLayout

        android:id="@+id/confirmPassword_TIL"
        android:layout_width="250dp"
        android:layout_height="wrap_content"

        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:layout_below="@id/password_TIL">

        <com.google.android.material.textfield.TextInputEditText

            android:id="@+id/confirmPassword_TIET"
            android:layout_width="match_parent"
            android:layout_height="match_parent"

            android:hint="@string/confirm_password"/>

    </com.google.android.material.textfield.TextInputLayout>
    <!-- SignIn-->
    <androidx.appcompat.widget.AppCompatButton

        android:id="@+id/signIn_BTN"
        android:layout_width="100dp"
        android:layout_height="wrap_content"

        android:text="@string/sign_in"
        android:textColor="@android:color/white"
        app:cornerRadius="50dp"
        android:elevation="2dp"
        android:layout_below="@id/confirmPassword_TIL"
        android:layout_marginTop="20dp"
        android:layout_centerHorizontal="true"
        android:background="@android:color/holo_blue_light"/>

</RelativeLayout>

MainActivity 中没有任何内容 - 已初始化

清单文件也没有添加任何额外内容。关于为什么会发生此错误的任何解释。还显示了另一个错误。

E/InputTransport: ro.sf.lcd_density must be defined as a build property

【问题讨论】:

标签: java android android-studio


【解决方案1】:

我遇到了同样的问题,但我的问题是因为屏幕密度。您可能需要修改可绘制文件夹中的图像或图标大小,然后生成副本到以下目录。

res/
  drawable-xxxhdpi/
    example.png
  drawable-xxhdpi/
    example.png
  drawable-xhdpi/
    example.png
  drawable-hdpi/
    example.png
  drawable-mdpi/
    example.png

更多信息请阅读here

【讨论】:

  • 我有很多图片,应该全部都这样吗?
  • 是的,您应该将所有图像的副本分发到这些目录...然后系统将根据您的应用运行设备的像素密度自动选择正确的图像:
猜你喜欢
  • 2019-08-16
  • 2020-03-31
  • 2019-08-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-06-23
  • 1970-01-01
  • 2020-05-28
相关资源
最近更新 更多