android - 条目名称“res/color/material_on_surface_disabled.xml”发生冲突
问题描述
我刚刚创建了一个签名的 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/ build或 yourProjectFoler/build中删除你的build文件夹
- 从 android/app/ release或 yourProjectFoler/release中删除您的发布文件夹
- android studio 的最后一步goto => Build > Rebuild Project
现在试试!我希望它会工作...
推荐阅读
- python - 从 torch.Tensor 中删除一个元素
- cypress - 赛普拉斯 - 当其他网址上的身份重定向时,我的测试无法继续
- javascript - 接收字符串而不是数组
- flutter - Flutter:从指定位置访问文件
- highcharts - 在 Highcharts 组织结构图中向下钻取?
- mysql - 如果其中一列的数据超过 1024 个字符,则不返回记录集 Mysql 8.0 和 Classic ASP
- python - 从熊猫数据框中绘制按时间顺序排序的数据
- python - Python lambda反向映射
- javascript - 将使用 mediaRecorder 制作的视频上传到服务器
- python - 如何从 PyQt5 中的第二个文件访问第一个文件方法?