Android WebView 加载失败(net::ERR_CLEARTEXT_NOT_PERMITTED)

解锁正确姿势
首先保证App申明了网络权限

  1. <uses-permission android:name="android.permission.INTERNET" />

解决办法(1):
在Application中打开一个开关

  1. <manifest ...>
  2. <application
  3. ...
  4. android:usesCleartextTraffic="true"
  5. ...>
  6. ...
  7. </application>
  8. </manifest>
  1. 解决办法(2):<br />res 下新建 xml 目录,创建文件:network_security_config.xml ,内容如下:

<?xml version=”1.0” encoding=”utf-8”?>

  1. AndroidManifest.xml application 标签添加配置:

  1. 解决办法(3):【推荐】<br />服务器和本地应用都改用 https
  2. 解决办法(4):<br />targetSdkVersion 降级回到 27
  3. <a name="1TRKs"></a>
  4. ### Uncaught TypeError: Cannot read property 'getItem' of null

WebSettings settings = mWebView.getSettings(); settings.setDomStorageEnabled(true);//开启DOM

  1. <a name="b382e7c6"></a>
  2. ### gradle使用dokka插件出现Exception while loading package-list from ExternalDocumentationLinkImp
  3. 请求不到 package-list,翻墙即可解决<br />不翻墙的解决方案如下:

dokka { outputFormat = ‘javadoc’ outputDirectory = javadoc.destinationDir

  1. configuration {
  2. externalDocumentationLink {
  3. noJdkLink = true
  4. noStdlibLink = true
  5. noAndroidSdkLink = true
  6. url = new URL("https://developer.android.google.cn/reference/")
  7. packageListUrl = new URL("https://developer.android.google.cn/reference/package-list")
  8. }
  9. }

}

  1. [https://github.com/Kotlin/dokka/issues/213#](https://github.com/Kotlin/dokka/issues/213#)<br />[https://www.cnblogs.com/zhhiyp/p/9484544.html](https://www.cnblogs.com/zhhiyp/p/9484544.html)
  2. <a name="Kv9SS"></a>
  3. ### More than one file was found with OS independent path 'lib/armeabi/xxxx.so'
  4. so 重复

// 在build.gradle(Module: app)里面,加上一句: packagingOptions { exclude ‘lib/armeabi/xxx.so’ // 或者 pickFirst ‘lib/armeabi/xxx.so’ }

  1. <a name="3b5dJ"></a>
  2. ### Go to the documentation to learn how to Fix dependency resolution errors.
  3. 依赖库版本冲突<br />解决方法 1:

subprojects { configurations.all { … resolutionStrategy.eachDependency { details -> if (details.requested.group == ‘androidx.annotation’) { details.useVersion “1.1.0” } … } } }

  1. 解决方法 2
  2. [https://www.jianshu.com/p/25286dd8bd09](https://www.jianshu.com/p/25286dd8bd09)
  3. <a name="41sHy"></a>
  4. ### gradle使用dokka插件出现Exception while loading package-list from ExternalDocumentationLinkImp
  5. 请求不到 package-list,翻墙即可解决<br />不翻墙的解决方案如下:

dokka { outputFormat = ‘javadoc’ outputDirectory = javadoc.destinationDir

  1. configuration {
  2. externalDocumentationLink {
  3. noJdkLink = true
  4. noStdlibLink = true
  5. noAndroidSdkLink = true
  6. url = new URL("https://developer.android.google.cn/reference/")
  7. packageListUrl = new URL("https://developer.android.google.cn/reference/package-list")
  8. }
  9. }

}

  1. [https://github.com/Kotlin/dokka/issues/213#](https://github.com/Kotlin/dokka/issues/213#)<br />[https://www.cnblogs.com/zhhiyp/p/9484544.html](https://www.cnblogs.com/zhhiyp/p/9484544.html)
  2. <a name="6ca21055"></a>
  3. ### A POM cannot have multiple artifacts with the same type and classifier
  • What went wrong: Execution failed for task ‘:emao-lib:lib-base:uploadToLocalSnapshot’.

    Could not publish configuration ‘archives’ A POM cannot have multiple artifacts with the same type and classifier. Already have MavenArtifact lib-base:aar:aar:null, trying to add MavenArtifact lib-base:aar:aar:null. ```

原因:上传的 artifacts 中包含多个 aar
处理方案:请参考 https://www.yuque.com/ypwcode/alcnpk/maven-fa-bu-aar