Android studio新建文件出现setContentView(R.layout.activity_main);中的R标红错误解决方法...

今天打开Android studio突然出现了setContentView(R.layout.activity_main);中的R标红错误,这已经不是第一次出现这个错误了,真心的觉得Android studio是真的不稳定,找了半天发现我的资源文件res下面的好多文件出现了乱码,(我也是醉了)。把他们一个一个的替换成正确的代码终于rebulid project不再出现错误了。

"1.0" encoding="utf-8"?>
"http://schemas.android.com/apk/res/android">
    "@drawable/ic_launcher_background" />
    "@drawable/ic_launcher_foreground" />

这是mipmap下的ic_lanucher和ic_lanucher_round通用的代码。


"1.0" encoding="utf-8"?>
"http://schemas.android.com/apk/res/android"
    android:width="108dp"
    android:height="108dp"
    android:viewportWidth="108"
    android:viewportHeight="108">
    <path
        android:fillColor="#008577"
        android:pathData="M0,0h108v108h-108z" />
    <path
        android:fillColor="#00000000"
        android:pathData="M9,0L9,108"
        android:strokeWidth="0.8"
        android:strokeColor="#33FFFFFF" />
    <path
        android:fillColor="#00000000"
        android:pathData="M19,0L19,108"
        android:strokeWidth="0.8"
        android:strokeColor="#33FFFFFF" />
    <path
        android:fillColor="#00000000"
        android:pathData="M29,0L29,108"
        android:strokeWidth="0.8"
        android:strokeColor="#33FFFFFF" />
    <path
        android:fillColor="#00000000"
        android:pathData="M39,0L39,108"
        android:strokeWidth="0.8"
        android:strokeColor="#33FFFFFF" />
    <path
        android:fillColor="#00000000"
        android:pathData="M49,0L49,108"
        android:strokeWidth="0.8"
        android:strokeColor=

你可能感兴趣的:(移动开发)