[英].app domain package name for android application
I have a.app domain registered and wanted to rename android application package with.app in the part, however after I changed the package name to.aap to.app view binding is not working and can't import R class我注册了一个 .app 域,想在部分中将 android 应用程序 package 重命名为 .app,但是在我将 package 名称更改为 .aap 到 .app 后,视图绑定不起作用并且无法导入 R class
There are two possible causes of this issue:此问题有两个可能的原因:
build.gradle
file.build.gradle
文件中指定的 ApplicationID 生成的。This is a common issue of build cache.这是构建缓存的常见问题。 Generally, the ViewBinding is created based on your Application ID specified in AndroidManifest and
build.gradle
file.通常,ViewBinding 是根据您在 AndroidManifest 和
build.gradle
文件中指定的应用程序 ID 创建的。
When you update the package name, the build cache is sometimes marked as dirty (ie invalid or expired).当您更新 package 名称时,构建缓存有时会被标记为脏(即无效或过期)。 Which doesn't allow you to access some auto generated classes like ViewBindings/DataBindings/Dependency injection classes.
这不允许您访问一些自动生成的类,例如 ViewBindings/DataBindings/Dependency 注入类。
The only solution for this problem is performing a clean build as follow:此问题的唯一解决方案是执行干净的构建,如下所示:
Build -> Rebuild Project
.Build -> Rebuild Project
。./gradlew clean build
../gradlew clean build
。 In case your project build is failing, try to temporarily comment the code base causing the build failure and try above steps again.如果您的项目构建失败,请尝试暂时注释导致构建失败的代码库,然后重试上述步骤。 Once your build is successful, you can now revert back the commented changes.
构建成功后,您现在可以恢复注释的更改。 (NOTE: While uncommenting the codebase, make sure import statements are correct, ie they are using the latest package name).
(注意:取消注释代码库时,确保导入语句正确,即它们使用最新的 package 名称)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.