Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 条目名称';res/color/material_on_surface_disabled.xml';碰撞_Android_Android Studio_Android Layout_Kotlin_Android Webview - Fatal编程技术网

Android 条目名称';res/color/material_on_surface_disabled.xml';碰撞

Android 条目名称';res/color/material_on_surface_disabled.xml';碰撞,android,android-studio,android-layout,kotlin,android-webview,Android,Android Studio,Android Layout,Kotlin,Android Webview,我刚刚创建了一个签名的apk,之后,我将两个文件添加到我的项目中——my_web_activity.xml和MyWebActivity.kt。编译代码后,我得到了错误——“条目名'res/color/material\u on\u surface\u disabled.xml'collide”没有指定其他内容 my_web_activity.xml <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout

我刚刚创建了一个签名的apk,之后,我将两个文件添加到我的项目中——my_web_activity.xml和MyWebActivity.kt。编译代码后,我得到了错误——“条目名'res/color/material\u on\u surface\u disabled.xml'collide”没有指定其他内容

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)
    }

}
```

```
MyWebActivity.kt
```
包com.albertjokelin.revisive
导入android.os.Bundle
导入androidx.appcompat.app.appcompat活动
导入com.google.android.gms.ads.AdRequest
导入com.google.android.gms.ads.AdView
导入com.google.android.gms.ads.MobileAds
类MyWebActivity:AppCompatActivity(){
lateinit var mAdView:AdView
重写创建时的乐趣(savedInstanceState:Bundle?){
super.onCreate(savedInstanceState)
setContentView(R.layout.my_web_活动)
//谷歌广告视图
MobileAds.initialize(此)
mAdView=findviewbyd(R.id.adView)
val adRequest:adRequest=adRequest.Builder().build()
mAdView.loadAd(adRequest)
}
}
```

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

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

  • 现在试试!我希望它能工作…

    转到“构建>清理项目”

    尝试使缓存无效并重新启动,工作正常。主要原因是android studio试图更新构建索引,但无法访问它

    删除项目层次结构中的
    构建
    文件夹和应用程序层次结构中的
    发布
    /
    调试
    文件夹,然后重建项目,这对我来说很有效。

    不要删除任何东西,只需关闭android studio,然后打开,然后对项目进行清理和重建,一切都会很好

    我尝试了
    构建->清理项目
    文件->也使缓存无效

    什么都没用

    唯一对我有效的是删除以前生成的apk


    这是在android/app/debug/app debug.apk中,你试过重建项目吗?这对我来说很有效-事实上,只是做“构建>清理项目”对我来说很有效-但我每次更换设备时都要做,这是非常频繁的。显然,这似乎是构建过程中的一个问题。我同意构建过程中存在严重缺陷。现在,如果没有一些
    元数据冲突
    消息迫使我执行上述所有步骤,我将无法再生成已签名的APK。似乎我的Android生活还没有完全悲惨,显然,生成APK已经不可能了。这对我来说也很有效。“清理项目”+“重建项目”