当前位置:   article > 正文

android开发中遇到的问题和注意点_安卓algorithm hmacpbesha256 not available

安卓algorithm hmacpbesha256 not available

(1)放在drawble下的图片资源名称不能大写

(2)ScrollView只能容纳一个子视图

(3)报错:Algorithm HmacPBESHA256 not available。

解决:设置 => 构建、执行、部署 => 构建工具 => gradle,修改gradle JVM的版本为更高版本(比如jbr17)

(4)报错:Dependency 'androidx.lifecycle:lifecycle-viewmodel:2.6.2' requires libraries and applications that depend on it to compile against version 33 or later of the Android APIs.

解决:修改build.gradle文件相关属性为:compileSdk 33,targetSdk 33(或更高版本)

(5)报错:Duplicate class kotlin.collections.jdk8.CollectionsJDK8Kt found in modules kotlin-stdlib-1.8.22 (org.jetbrains.kotlin:kotlin-stdlib:1.8.22) and kotlin-stdlib-jdk8-1.7.21 (org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.7.21)

解决:在Gradle Scripts => build.gradle.kts => dependencies里添加:implementation(platform("org.jetbrains.kotlin:kotlin-bom:1.8.0"))

(6)报错:Cannot find implementation for com.example.biluo.database.UserDatabase. UserDatabase_Impl does not exist

注意:@Entiy注解标识的类不能有构造方法

原因:room依赖的引入在kotlin下和java不同

  1. // build.grade文件
  2. //java中room依赖的导入:
  3. implementation 'androidx.room:room-runtime:2.5.0'
  4. annotationProcessor 'androidx.room:room-compiler:2.5.0'
  5. // kotlin中要改成:
  6. // plugins要先加上:id 'kotlin-kapt'
  7. implementation 'androidx.room:room-runtime:2.5.0'
  8. kapt 'androidx.room:room-compiler:2.5.0'

(7)报错:Module was compiled with an incompatible version of Kotlin. The binary version of its metadata is 1.8.0, expected version is 1.6.0.

解决:在保证kotlin版本是大于等于1.8.0的前提下,在build.gradle(:app)下的根添加以下内容

  1. kotlin {
  2. version '1.9.10'
  3. }

(8)报错:Binary XML file line #20: Error inflating class fragmen

解决:静态注册的fragment所在布局文件对应的Activity不能用 `ViewBinding`(不知道原因,谁知道的请告诉我一下)
 网上:

  •     标签对应的类路径不能写错
  •     fragment标签要有id
  •     对应Activity要继承AppCompatActivity或FragmentActivity,而不能继承Activity
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Cpp五条/article/detail/504304
推荐阅读
相关标签
  

闽ICP备14008679号