android - 条目名称 'res/color/material_on_surface_disabled.xml' 发生冲突

标签 android android-studio android-layout kotlin android-webview

我刚刚创建了一个签名的 apk,之后,我在我的项目中添加了两个文件 - my_web_activity.xml 和 MyWebActivity.kt。编译代码后,我得到了错误——“Entry name 'res/color/material_on_surface_disabled.xml' collided”Nothing else is specified。
my_web_activity.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_height="match_parent">

    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="false"
        app:adSize="BANNER"
        app:adUnitId="ca-app-pub-3940256099942544/6300978111"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintHorizontal_bias="0.0"
        app:layout_constraintStart_toStartOf="parent" />

    <WebView
        android:id="@+id/my_web_view"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginBottom="1dp"
        app:layout_constraintBottom_toTopOf="@+id/adView"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
```

MyWebActivity.kt
```
package com.albertjokelin.revise

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.gms.ads.AdRequest
import com.google.android.gms.ads.AdView
import com.google.android.gms.ads.MobileAds

class MyWebActivity : AppCompatActivity() {

    lateinit var mAdView: AdView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)

        setContentView(R.layout.my_web_activity)

        // Google Ad view
        MobileAds.initialize(this)
        mAdView = findViewById(R.id.adView)
        val adRequest: AdRequest = AdRequest.Builder().build()
        mAdView.loadAd(adRequest)
    }

}
```

Edit: I ended up rebuilding the whole project from scratch after trying everything available at that time. So I don't know which solution works. Cheers!

最佳答案

当我在闪屏和 中进行更新时,我遇到了这个问题快速解决方案是

  • 删除您的构建 来自 android/app/ 的文件夹构建 或您的ProjectFoler/build
  • 删除您的发布来自 android/app/ 的文件夹发布或您的ProjectFoler/发布
  • 最后一步来自android studio goto => 构建 > 重建项目

  • 现在试试!我希望它会工作...

    关于android - 条目名称 'res/color/material_on_surface_disabled.xml' 发生冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61537333/

    相关文章:

    android - HTC Desire 中的数据库锁定问题

    android - 如何以完整 HTML 格式在 WebView 中显示来自 feedburner 的内容?

    android - 动态水平 View

    android - 在 NestedScrollView 中使用 ListViews 的正确替代方法是什么?

    Android Studio 突然无法解析符号

    android - coordinatorlayout 中的 Recyclerview

    android - 如果有 getArguments(),我们是否应该在 fragment 中使用 savedInstanceState?

    java - Android 写入输出流时出现 = java.net.ProtocolException : exceeded content-length limit of 0 bytes,

    android - 在 Android Studio 中找不到 Theme.AppCompat.Light 资源

    Android Studio 提交和推送错误