2020-12-13 Lint found errors in the project; aborting build导致打包停止错误解决 Lint found errors in the project; aborting build导致打包停止错误解决 今天在打包时的时候出现了这个错导致打包不成功,具体原因可以从报错日志中看到是因为studio检测到了lint错误,从而停止了打包。解决办法是在app下的build.gradle 文件的android节点下添加lintOptions{ abortOnError false }即可,即在检测到lint错误时还接续进行打包。7:00:55 :app:lint FAILED 17:00:55 17:00:55 FAILURE: Build failed with an exception. 17:00:55 17:00:55 * What went wrong: 17:00:55 Execution failed for task ':app:lint'. 17:00:55 > Lint found errors in the project; aborting build. 17:00:55 17:00:55 Fix the issues identified by lint, or add the following to your build script to... Laughing 2020-12-13 App开发 2,472 阅读 0 评论 2020年12月13日 2,472 阅读 0 评论
2020-12-12 getResources().getDrawable()过时问题解决 getResources().getDrawable()过时问题解决 Android开发时,我们经常会动态指定按钮的背景图。如果我们使用shareItem.setBackground(getResources().getDrawable(R.color.teal_200));设置时,会收到Ide的提示,我们有三种方式解决此问题:1)使用drawable资源但不为其设置theme主题ResourcesCompat.getDrawable(getResources(), R.drawable.name, null); //null就是null,不设主题``如:myexample.setIcon(ResourcesCompat.getDrawable(getResources(), R.mipmap.ic_launcher, null)); 2)使用默认的activity主题ContextCompat.getDrawable(getActivity(), R.drawable.name); //getActivity(),如果是在activity里就直接用this``如:myexample.setIcon(ContextCompat.getDra... Laughing 2020-12-12 Web前端 1,928 阅读 0 评论 2020年12月12日 1,928 阅读 0 评论
2020-12-10 非常简单的Android Studio中第三方源码导入 非常简单的Android Studio中第三方源码导入 Android开发时,我们经常需要导入第三方的源码。之前看看其他人分享的,感觉都看的稀里糊涂的,作为一个Android开发新人一脸懵逼。这里给大家介绍一种非常简单的导入方法。这里以一个动态权限的源码导入为例子进行说明。github地址:https://github.com/forJrking/HeiPermission下载源码这个不多介绍,去上面地址下载就行了。解压代码解压代码,我们会得到permlib文件夹,如下拷贝代码将permlib整个文件夹拷贝到我们的工程中修改settings.gradle找到我们工程的settings.gradle文件,修改如下添加依赖找到我们模块的build.gradle。修改项目结构打开项目结构,修改模块的jdk版本最后引入完成后Android studio会自动构建成功,如果有报错,修改错误即可。 Laughing 2020-12-10 App开发 1,153 阅读 0 评论 2020年12月10日 1,153 阅读 0 评论
2020-11-08 通过软连接解决Android studio不支持中文路径的问题 通过软连接解决Android studio不支持中文路径的问题 Android studio默认不支持中文路径,比较坑爹。但是我们路径中难免会出现中文路径。通过软连接解决这里提供一种思路,就是通过软件链接的方式进行解决。首先我们打开cmd窗口输入mklink /d C:\Users\laughing\link\companycode C:\Users\laughing\Seafile\私人资料库\公司资料\00.代码 ,前面的路径是要创建的链接路径,也就是不包含中文名的,后面的是原始的路径。这样我们后期在使用Android Studio时,直接使用不包含中文的路径即可 Laughing 2020-11-08 App开发 1,429 阅读 1 评论 2020年11月08日 1,429 阅读 1 评论