AndroidStudio 新建Module 时 Project needs to be converted to androidx.* dependencies最简单解决方法

网上一堆在gradle.properties 文件中加以下两句话,测试后没用:

android.useAndroidX=true
android.enableJetifier=true
最简单的方法是在创建modle时直接换掉minimum sdk,换成带 google的,创建好后在做更改
在这里插入图片描述
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
What’s New in Version 8.12? For those of you who have read previous editions of this book, here are some of the highlights of what is new in the prose in Version 8.12. This update: • Adds more to the Android P coverage, including: ◦ A dedicated chapter on publising slices ◦ BiometricPrompt (as the replacement for FingerprintDialog, which itself replaces the now-deprecated FingerprintManager) ◦ AppComponentFactory ◦ WebView tracing ◦ New salvos in “the War on Background Processing” • Updates much of the book to cover Android Studio 3.1 • Added material on the 1.1 release of ConstraintLayout, including groups, barriers, percentage constraints, and circular constraints • Rewrote the fragments chapter to focus on the fragments backport • Updated most remaining samples to use the fragments backport, for those that were not doing so already • Converted some samples that were using ListView to use RecyclerView, and moved the RecyclerView chapter to be earlier in the book • Added some material on the Chrome OS emulator • Moved the material on SlidingPaneLayout to the Widget Catalog • Made minor improvements to the chapters on Espresso, unit testing, and Ui Automator • Retired the chapter on dynamic code, the chapter on Android Things, the chapter on SlidingDrawer (from the Widget Catalog), and the chapter on l PREFACE large screen strategies, as well as some other specific sample apps and their corresponding sections) • Fixes a variety of errata and other miscellaneous bugs
这个问题是因为 Apifox 采用了 Node.js 的 CommonJS 模块规范,而 CryptoJS 库基于 ES6 模块规范开发,所以在 Apifox 中使用会提示这个警告。 可以通过以下方式解决这个问题: 1. 在 Apifox 中创建一个 API 接口,并且设置需要进行加解密的请求参数。 2. 在 API 接口中添加一个预处理脚本,用于调用 CryptoJS 进行加解密操作。预处理脚本可以使用 JavaScript 编写。 3. 在预处理脚本中使用以下代码将 CryptoJS 转换为 CommonJS 模块: ``` // 将 CryptoJS 转换为 CommonJS 模块 var CryptoJS = require('./crypto-js.js'); ``` 4. 在预处理脚本中使用 CryptoJS 进行加解密操作。例如,以下代码可以使用 AES 算法对请求参数进行加密: ``` // 获取请求参数 var params = JSON.stringify(request.params); // 定义密钥和初始化向量 var key = CryptoJS.enc.Utf8.parse("1234567890123456"); var iv = CryptoJS.enc.Utf8.parse("1234567890123456"); // 加密请求参数 var encrypted = CryptoJS.AES.encrypt(params, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); // 将加密后的参数添加到请求中 request.params = { data: encrypted.toString() }; ``` 5. 在预处理脚本中使用 CryptoJS 进行解密操作。例如,以下代码可以使用 AES 算法对返回结果进行解密: ``` // 获取返回结果 var result = JSON.parse(response.content); // 定义密钥和初始化向量 var key = CryptoJS.enc.Utf8.parse("1234567890123456"); var iv = CryptoJS.enc.Utf8.parse("1234567890123456"); // 解密返回结果 var decrypted = CryptoJS.AES.decrypt(result.data, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); // 将解密后的结果添加到响应中 response.content = decrypted.toString(CryptoJS.enc.Utf8); ``` 通过以上步骤,就可以在 Apifox 中成功调用 CryptoJS 进行加解密操作了。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值