无法解析 R [无 admob]
Cannot Resolve R [No admob]
我搜索了其他答案并尝试找到解决方案,我知道有人问过这个问题。
我的 Android Studio 突然找不到 R class (R.raw.blabla
)。
找不到任何 R 文件
在其他 classes 中它正在工作。
我尝试了什么:
- 清理项目
- 手动导入 R
- 在 Manifest/Gradle applicationId
中检查正确的包名称
- 清除 Gradle (
gradlew clean
)
- 重建(Gradle 并从工具 window)
- 使缓存无效并重新启动
- 重启OS
- 删除 .gradle 目录
- 使用 AS
重新同步 Gradle 个文件
- 运行 代码分析和修复任何 warnings/Errors
- 浏览整个 xml 个文件并搜索 bugs/typos
- 重新导入项目
- 更新 SDK tools/re-download
- 更新构建工具
- 更新依赖项
- 删除 .idea 文件夹
- 制作项目,制作模块
- 重新安装Android Studio
- 下载最新的 Android Studio (Canary 3.3 Canary 11 Sept 15 2018)
- 使用 Gradle 修复 lint 错误 (gradlew lintFix)
- 更新 Gradle 包装器
- 禁用 D8
- 启用 D8
- assemble
- cleanBuildCache
- 更新 Kotlin 版本
- 将 Kotlin 版本从 Dev (1.3-20M) 还原到(到 1.2.70)
- 部分删除所有依赖项,然后一一重新添加
- 删除所有子项目构建文件夹,清理并重新构建
- 从 targetSDK/CompileSDK/BuildTools 28 恢复到 27
只有 2 xml 个文件仍然有错误
-没有其他 xml 文件被修改我的意思是默认值
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_constraint_layout">
<TextView
android:id="@+id/month_textView"
style="@style/textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Aug" />
<TextView
android:id="@+id/dayNr_textView"
style="@style/textStyle"
app:layout_constraintEnd_toEndOf="@+id/month_textView"
app:layout_constraintStart_toStartOf="@+id/month_textView"
app:layout_constraintTop_toBottomOf="@+id/month_textView"
tools:text="05" />
<TextView
android:id="@+id/day_textView"
style="@style/textStyle"
app:layout_constraintEnd_toEndOf="@+id/dayNr_textView"
app:layout_constraintStart_toStartOf="@+id/dayNr_textView"
app:layout_constraintTop_toBottomOf="@+id/dayNr_textView"
tools:text="Sun" />
</android.support.constraint.ConstraintLayout>
实际上我找到了一个奇怪的解决方案:
我试图从 Canary(2018 年 9 月 5 日 3 月 11 日)在 stable/beta Android Studio (3.2) 上导入项目
在 stable/beta 频道上,R class 构建成功,我可以导入它。
最后出于好奇,我重新加载了 Canary 版本的项目。一切正常。
不过最后我还是决定留在稳定频道,等RC发布。
我搜索了其他答案并尝试找到解决方案,我知道有人问过这个问题。
我的 Android Studio 突然找不到 R class (R.raw.blabla
)。
找不到任何 R 文件
在其他 classes 中它正在工作。
我尝试了什么:
- 清理项目
- 手动导入 R
- 在 Manifest/Gradle applicationId 中检查正确的包名称
- 清除 Gradle (
gradlew clean
) - 重建(Gradle 并从工具 window)
- 使缓存无效并重新启动
- 重启OS
- 删除 .gradle 目录
- 使用 AS 重新同步 Gradle 个文件
- 运行 代码分析和修复任何 warnings/Errors
- 浏览整个 xml 个文件并搜索 bugs/typos
- 重新导入项目
- 更新 SDK tools/re-download
- 更新构建工具
- 更新依赖项
- 删除 .idea 文件夹
- 制作项目,制作模块
- 重新安装Android Studio
- 下载最新的 Android Studio (Canary 3.3 Canary 11 Sept 15 2018)
- 使用 Gradle 修复 lint 错误 (gradlew lintFix)
- 更新 Gradle 包装器
- 禁用 D8
- 启用 D8
- assemble
- cleanBuildCache
- 更新 Kotlin 版本
- 将 Kotlin 版本从 Dev (1.3-20M) 还原到(到 1.2.70)
- 部分删除所有依赖项,然后一一重新添加
- 删除所有子项目构建文件夹,清理并重新构建
- 从 targetSDK/CompileSDK/BuildTools 28 恢复到 27
只有 2 xml 个文件仍然有错误
-没有其他 xml 文件被修改我的意思是默认值
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/root_constraint_layout">
<TextView
android:id="@+id/month_textView"
style="@style/textStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Aug" />
<TextView
android:id="@+id/dayNr_textView"
style="@style/textStyle"
app:layout_constraintEnd_toEndOf="@+id/month_textView"
app:layout_constraintStart_toStartOf="@+id/month_textView"
app:layout_constraintTop_toBottomOf="@+id/month_textView"
tools:text="05" />
<TextView
android:id="@+id/day_textView"
style="@style/textStyle"
app:layout_constraintEnd_toEndOf="@+id/dayNr_textView"
app:layout_constraintStart_toStartOf="@+id/dayNr_textView"
app:layout_constraintTop_toBottomOf="@+id/dayNr_textView"
tools:text="Sun" />
</android.support.constraint.ConstraintLayout>
实际上我找到了一个奇怪的解决方案:
我试图从 Canary(2018 年 9 月 5 日 3 月 11 日)在 stable/beta Android Studio (3.2) 上导入项目 在 stable/beta 频道上,R class 构建成功,我可以导入它。 最后出于好奇,我重新加载了 Canary 版本的项目。一切正常。 不过最后我还是决定留在稳定频道,等RC发布。