Android工程一些编译报错的解决方案

  1. Some problems were found with the configuration of task ‘:app:generateSafeArgsDebug’ (type ‘ArgumentsGenerationTask’).
    Type ‘androidx.navigation.safeargs.gradle.ArgumentsGenerationTask’ property ‘applicationId’ is missing an input or output annotation.
    解决方案:是因为navigation-safe-args-gradle-plugin插件版本太低引起,修改下版本号即可,例如
    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:1.0.0"

修改为

    classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
  1. Using insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository ‘maven(http://maven.aliyun.com/nexus/content/groups/public)’ to redirect to a secure protocol (like HTTPS) or allow insecure protocols. See …
    解决方案:设置对应的maven库的allowInsecureProtocol 属性设置
    修改为
   maven {
    
    
      allowInsecureProtocol = true
      url 'http://maven.aliyun.com/nexus/content/groups/public/'
     }
  1. this.activity?.let{…}
    let、also等kotlin相关的关键字标红,需要在project的build.gradle文件中添加
   dependencies {
    
    
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" 
    }

在app的build.gradle文件中添加

 dependencies {
    
    
        implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.6.10"
    }

猜你喜欢

转载自blog.csdn.net/wudexiaoade2008/article/details/122022385
今日推荐