MantisBT配置邮件出现发不出去的问题
1 | 2018-05-15 07:58:48 SMTP NOTICE: EOF caught while checking if connected |
解决方法: 在mantisbt/config/config.ini.php(配置好PHPMailer)
1 | # --- Email Configuration --- |
Hexo相关问题
加入背景图片
1.设置站点_config.yml
1 | post_asset_folder:true |
2.安装hexo-asset-image
1 | npm install hexo-asset-image --save |
3.加入背景图片,主题目录下(themes\next\source\css\_custom\custom.styl)
1 | .header { |
4.再重新部署即可
设置字体颜色及checkbox
1 | - [x] <font color=#A52A2A>最近灯光</font> |
- 最近灯光
- 灯光呈现
- 绑定设备
生成时提示highlight出错
TypeError: Cannot set property ‘lastIndex’ of undefined at highlight (..\node_modules\highlight.js\lib\highlight.js:511:35)
更改站点配置
1 | highlight: |
添加文章更新时间
1.修改/themes/next/layout/_macro/post.swig文件,在<span class="post-time">...</span>
标签后添加
1 | {%if post.updated and post.updated > post.date%} |
2.修改/themes/next/languages/en.yml
1 | post: |
3.如果是中文就更改zh_Hans.yml
1 | post: |
4.修改主题配置文件/themes/next/_config.yml,增加一行
1 | display_updated: true |
参考:hexo添加文章更新时间
minifier压缩
1.安装
1 | npm install hexo-all-minifier --save |
2.package.json的配置会多出
1 | "hexo-all-minifier": "^0.5.2", |
3.配置站点_config.yml
1 | # minifier |
搜索功能
1.安装
1 | npm install hexo-generator-searchdb --save |
2.修改站点配置
1 | search: |
3.修改主题配置
1 | local_search: |
表格中换行
1 | <br> |
表格宽度调整
在themes\next\source\css_custom\custom.styl中加入以下代码
1 | table th:first-of-type { |
华丽丽的分割线
分割线的语法只需要三个星号*
或者三个小短线-
号
提交谷歌搜索
1.安装插件
1 | npm install hexo-generator-sitemap --save |
2.修改站点配置
1 | sitemap: |
3.source目录下新建robots.txt,内容如下:
1 | User-agent: * |
4.重新发布
1 | hexo clean & hexo g & hexo d |
5.注册账号,添加域名
6.测试robots.txt
点击左侧抓取 > robots.txt测试工具,若提示0错误则OK
7.提交站点地图
点击左侧抓取 > 站点地图,右上角添加/测试站点地图
输入sitemap.xml,先点测试,如果没问题的话,再提交。
集成一言
修改themes\next\layout\_layout.swig
,在</body>
前加入:
1 | <script type="text/javascript"> |
这样会导致站点subtitle配置无效
1 | # Site |
参考:一言网 Api 接口说明
嵌入视频
1 | <center> |
Material surfaces at different elevations cast shadows.
视频来源:https://material.io/design/environment/surfaces.html#properties
Java相关问题
修饰符顺序声明
1 | The Java Language Specification recommends listing modifiers in the following order: |
gson库json设置别名
com.google.code.gson:gson:2.8.0
1 | @SerializedName("original_title") |
tomcat manager 显示403
修改conf/Catalina/localhost/manager.xml
1 | <Context privileged="true" antiResourceLocking="false" |
Android相关问题
查看CPU信息
1 | adb shell cat /proc/cpuinfo |
使用命令安装应用
1 | adb uninstall 包名 |
RecycleView一行多列显示
1 | GridLayoutManager gridLayoutManager = new GridLayoutManager(mContext,3); |
ImageView.ScaleType
EnumValues | Description |
---|---|
CENTER | Center the image in the view, but perform no scaling. |
CENTER_CROP | Scale the image uniformly (maintain the image’s aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view (minus padding). |
CENTER_INSIDE | Scale the image uniformly (maintain the image’s aspect ratio) so that both dimensions (width and height) of the image will be equal to or less than the corresponding dimension of the view (minus padding). |
FIT_CENTER | Scale the image using Matrix.ScaleToFit.CENTER |
FIT_END | Scale the image using Matrix.ScaleToFit.END. |
FIT_START | Scale the image using Matrix.ScaleToFit.START. |
FIT_XY | Scale the image using Matrix.ScaleToFit.FILL. |
MATRIX | Scale using the image matrix when drawing. |
https://developer.android.com/reference/android/widget/ImageView.ScaleType
gradle build scan
将构建扫描发布到scans.gradle.com 将此数据传输到Gradle的服务器。
在Terminal窗口输入gradlew build --scan
打开链接,提示输入邮箱验证.
Spinner 设置字体颜色
定义spinner_item.xml:
1 | "1.0" encoding="utf-8" xml version= |
代码中使用:
1 | Spinner spinner = view_custom.findViewById(R.id.spi_change_sth); |
参考:https://stackoverflow.com/questions/4880413/text-color-of-a-closed-spinner
ProgressBar设置颜色
drawable/progress_bar.xml
1 | "1.0" encoding="utf-8" xml version= |
ProgressBar:
1 | <ProgressBar |
参考:https://stackoverflow.com/questions/18800290/how-to-change-progressbar-color
Toolbar中PopuMenu菜单显示位置
1 | <resources> |
修改Toolbar右上角三个圆点的颜色
1.第一种方式,修改android:textColorSecondary,辅助的文字颜色.
1 | <resources> |
2.推荐的方式,修改actionOverflowButtonStyle.
1 | <style name="AppTheme" parent="AppTheme.Base"> |
设置debug签名信息
在模块的 build.gradle中设置
1 | android { |
如果团队协作开发或者将代码开源,那么应当将此敏感信息从构建文件中移出,以免被其他人轻易获取。
1.在项目的根目录下创建一个名为 keystore.properties 的文件。
1 | storePassword=myStorePassword |
2.在模块的 build.gradle 文件中,于 android {} 块的前面添加用于加载 keystore.properties 文件的代码
1 | ... |
3.修改模块 build.gradle 文件的 signingConfigs 块
1 | android { |
现在可以将 keystore.properties 从源代码控制系统中移除。
参考: 签署您的应用 | Android Developers
打开通知授权界面
1 | Intent intent = new Intent("android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS"); |
FlycoTabLayout设置未读数量,位置有偏差
1 | int tabCount = 3; |
参考:https://github.com/H07000223/FlycoTabLayout/issues/24
androidTest与test包的区别
本地单元测试(src/test/java)
这些测试在计算机的本地 Java 虚拟机 (JVM) 上运行。 当您的测试没有 Android 框架依赖项或当您可以模拟 Android 框架依赖项时,可以利用这些测试来尽量缩短执行时间。
仪器测试(src/androidTest/java)
这些测试在硬件设备或模拟器上运行。 这些测试有权访问 Instrumentation API,让您可以获取某些信息(例如您要测试的应用的 Context), 并且允许您通过测试代码来控制受测应用。 可以在编写集成和功能 UI 测试来自动化用户交互时,或者在测试具有模拟对象无法满足的 Android 依赖项时使用这些测试。
来源: https://developer.android.com/studio/test/
Google Play商店更新应用(包名已更改)
只能取消发布,再创建新应用(并且之前的不能删除掉,因为Google支持用户无限制下载)
Google Play商店上架提示,您上传了可调试的APK或Android App Bundle.
您上传了可调试的 APK 或 Android App Bundle。出于安全考虑,您需要先停用 APK 或 Android App Bundle 的调试功能,然后才能在 Google Play 中进行发布。详细了解可调试的 APK 或 Android App Bundle。
1.左下角 Build Variants 修改模式为 release
2.gradle 中修改 debuggable 为 false
1 | android { |
3.Build > Generate Signed APK > 重新签名打包
参考:APK上传到play.google - 您上传了可调试的APK错误
Google Play商店上架提示,请将应用的最低目标API级别调整为26.
警告
您的应用目前的目标 API 级别为 19,请将应用的最低目标 API 级别调整为 26,以确保应用基于最新 API 而构建,让安全性和性能达到最佳状态。
自 2018 年 8 月起,新应用的指定目标至少必须是 Android 8.0(API 级别 26)。
自 2018 年 11 月起,应用更新的指定目标必须是 Android 8.0(API 级别 26)。
提示: 更改应用的目标 API 级别。了解详情。
将targetSdkVersion 改为26
1 | android { |
参考:Google Play 目标 API 等级(targetSdkVersion)重要变更要求
Android8.0开启热点
1 | import android.os.Build; |
目前会回调onStarted,onStopped和onFailed,但是开启的热点搜不到.需要手动开启热点
Android8.0获取热点信息失败
1 | W/System.err: java.lang.reflect.InvocationTargetException |
暂无解决方法
资源文件中出现百分号处理
1 | java.util.UnknownFormatConversionException: Conversion = 'End of String' |
xml中的配置,需要显示为正在下载 : 11%
1 | <string name="notify_updating_text">正在下载 : %1$d%</string> |
用%%来表示1个%
1 | <string name="notify_updating_text">正在下载 : %1$d%%</string> |
重复的包
1 | Error:Execution failed for task ':app:transformClassesWithJarMergingForRelease'. |
使用如下命令查看 Dependencies 依赖关系:
1 | gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath |
分析项目依赖:
1 | D:\Android\MarkDown>gradlew -q dependencies app:dependencies --configuration debugAndroidTestCompileClasspath |
找出重复的包,再exclude掉
1 | implementation('com.squareup.retrofit2:converter-simplexml:' + rootProject.retrofit2Version) { |
参考:http://www.paincker.com/gradle-dependencies
Could not find class ‘com.facebook.LoggingBehavior[]’
接入Facebook应用,debug模式打开异常,应用加上签名就好使了.
1 | E/dalvikvm: Could not find class 'com.facebook.LoggingBehavior[]', referenced from method com.facebook.FacebookSdk.<clinit> |
Execution failed for task ‘:app:transformClassesWithInstantRunForDebug’
1 | Execution failed for task ':app:transformClassesWithInstantRunForDebug' |
解决方法:打开File > Settings > Build,Execution,Deployment > Instant Run
去掉勾选Enable Instant Run to hot swap code/resource changes on deploy(default enabled)
参考:Error:Execution failed for task :app:transformClassesWithInstantRunForDebug解决方案
NestedScrollView嵌套RecyclerView时滑动不流畅问题的解决办法
1 | recyclerView.setNestedScrollingEnabled(false); |
参考:NestedScrollView嵌套RecyclerView时滑动不流畅
Glide加载图片出错
1 | java.lang.OutOfMemoryError: Failed to allocate a 31961100 byte allocation with 16777216 free bytes and 20MB until OOM, max allowed footprint 129449656, growth limit 134217728 |
解决方法:
1 | Glide.with(context) |
Generic advice here: https://bumptech.github.io/glide/doc/debugging.html#out-of-memory-errors
Could not find android.arch.core:common:1.1.0
1 | Error:FAILURE: Build failed with an exception. |
解决方法:
项目根目录调整仓库位置google()在前
1 | buildscript { |
Drawable has unresolved theme attributes!
1 | Drawable xxx/ic_navigate_back has unresolved theme attributes! |
解决方法:
1 | Drawable upArrow = ContextCompat.getDrawable(mContext,R.drawable.ic_navigate_back); |
ContextCompat.getDrawable(Context, int) 代替 getResources().getDrawable(int)
参考: https://github.com/afollestad/material-dialogs/issues/1002
在Fragment中使用StartActivityForResult,RequestCode错乱
1 | startActivityForResult(intent, 1); |
改为
1 | getActivity().startActivityForResult(intent, 1); |
Activity返回刷新界面
1.startActivityForResult
1 | private final static int REFRESH_RESULT_REQ = 101; |
2.startActivityForResult回调
1 |
|
Fragment返回刷新界面
重写onResume()
1 |
|
Toolbar不能同时显示图片和文字
1 |
|
xpp3 defines classes that conflict with classes now provided by Android.
1 | Error:Error: xpp3 defines classes that conflict with classes now provided by Android. |
解决方法:在app/build.gradle中添加
1 | android { |
参考:https://stackoverflow.com/questions/48488563/gradle-xpp3-error
Trouble processing “javax/xml/XMLConstants.class” in Android
1 | implementation ('com.squareup.retrofit2:converter-simplexml:2.3.0'){ |
接入TBS后,webView拍照上传图片失败
1 |
|
Failed to finalize session : INSTALL_FAILED_INVALID_APK: /.. signatures are inconsistent
1 | Installation failed with message Failed to finalize session : INSTALL_FAILED_INVALID_APK: /data/app/vmdl1718624679.tmp/2_dependencies signatures are inconsistent. |
先clean,再重新运行
TBS播放视频
1 | mActivity.getWindow().setFormat(PixelFormat.TRANSLUCENT); |
TBS报错Didn’t find class “com.tencent.smtt.export.external.interfaces.CorePermissionRequest
1 | Rejecting re-init on previously-failed class java.lang.Class<com.tencent.smtt.webkit.WebViewChromiumExtension$49>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/tencent/smtt/export/external/interfaces/CorePermissionRequest$CorePermissionRequestCallback; |
WebView监听上下滑动,设置工具栏隐藏
1 | float y1 = 0; |
android.os.DeadSystemException:
1 | android.os.DeadSystemException: The system died; earlier logs will point to the root cause |
Failed to resolve: common
1 | buildscript { |
将google()写在前面
在Fragment中使用MaterialSearchView
1 | setHasOptionsMenu(true); |
参考:https://github.com/MiguelCatalan/MaterialSearchView/issues/45
输入法将BottomNavigationBar(底部导航栏)顶上去
在应用清单中给当前
1 | android:windowSoftInputMode="adjustPan" |
参考:https://developer.android.google.cn/guide/topics/manifest/activity-element#wsoft
InnerClass annotations are missing corresponding EnclosingMember annotations.
1 | InnerClass annotations are missing corresponding EnclosingMember annotations. Such InnerClass annotations are ignored. |
解决方法:
1 | buildTypes { |
RecyclerView 最后一个item设置paddingBottom
1 | <android.support.v7.widget.RecyclerView |
参考: https://stackoverflow.com/questions/33754445/margin-padding-in-last-child-in-recyclerview
Git相关问题
切换目录
1 | cd /d |
Sonar相关问题
“BigDecimal(double)” should not be used
不要使用BigDecimal(double)去构造一个BigDecimal对象,因为double类型在计算机表示方法中并不精确,因此,BigDecimal(double)构造出来的对象很可能不是预期的大小,若一定要使用double类型去构造一个BigDecimal对象,请使用BigDecimal.valueOf方法,该方法先将double转换为String,再通过String构造BigDecimal对象,通常更建议使用public BigDecimal(String val)构造方法。
Noncompliant Code Example
1 | double d = 1.1; |
Compliant Solution
1 | double d = 1.1; |
see :
- SEI CERT Oracle Coding Standard for Java
- SonarSource Rules Explorer
- “BigDecimal(double)” should not be used
Lambdas should be replaced with method references
改成mView::scan
1 |
|
参考:Intellij - can be replaced with method reference
Jenkins相关问题
Could not find com.android.tools.build:gradle:3.0.1
1 | FAILURE: Build failed with an exception. |
提示连接到jcenter超时,在项目build.gradle中添加google()
1 | buildscript { |
Step ‘Publish JUnit test result report’ failed
1 | ERROR: Step 'Publish JUnit test result report' failed: No test report files were found. Configuration error? |
没有配置测试报告(XML)
1 | app/build/test-results/testDebugUnitTest/*.xml |
Execution failed for task ‘:app:transformClassesWithJacocoForDebug’.
1 | :app:transformClassesWithJacocoForDebug FAILED |
解决方法:
1 | classpath('com.dicedmelon.gradle:jacoco-android:0.1.2') { |
参考:https://github.com/arturdm/jacoco-android-gradle-plugin/issues/42
java.lang.IllegalStateException: No files nor directories matching ‘app/build/intermediates/classes’
Android Studio 3.3 Canary 2 生成的classes文件夹为app\build\intermediates\javac\debug\compileDebugJavaWithJavac\classes
需要将Jenkins项目配置
1.Execute SonarQube Scanner -> Analysis properties
1 | sonar.java.binaries=app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes |
2.Record JaCoCo coverage report -> Path to class directories (e.g.: /target/classDir, /classes)
1 | app/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes |
重新构建即可
Ruby相关问题
cannot load such file – sqlite3/sqlite3_native
1 | D:/Ruby25-x64/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32: |
1.install sqlite3
1 | $ ridk exec pacman -S mingw-w64-x86_64-sqlite3 |
2.进入到sqlite3目录
1 | cd D:\Ruby25-x64\lib\ruby\gems\2.5.0\gems\sqlite3-1.3.13 |
3.开启mingw编译环境
1 | $ ridk enable |
4.执行以下命令
1 | ruby setup.rb config |
参考: https://github.com/sparklemotion/sqlite3-ruby/issues/228
Node.js相关问题
解析mobi文件出错
https://github.com/ctbarna/node-mobi
1 | Error: LZ77 compression isn't supported... yet. |
暂未解决
Ubuntu14.04下安装node.js(默认版本太旧)
1 | cd ~ |
1 | sudo bash nodesource_setup.sh |
1 | sudo apt-get install nodejs |
nodejs 版本号:
1 | nodejs -v |
1 | v8.10.0 |
npm 版本
1 | npm -v |
1 | 5.6.0 |
参考: https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-16-04
Markdown to static HTML
1.安装 generate-md 插件
1 | sudo npm install -g markdown-styles |
2.将需要的markdown文件转换成html
1 | generate-md --layout github --input ./input --output ./output |
3.generate-md CLI 选项
- –input
指定输入目录(默认值:) ./input/ - –output
指定输出目录(默认值:) ./output/ - –layout
指定布局 - bootstrap3
- github
- jasonm23-dark
- jasonm23-foghorn
- jasonm23-markdown
- jasonm23-swiss
- markedapp-byword
- mixu-book
- mixu-bootstrap-2col
- mixu-bootstrap
- mixu-gray
- mixu-page
- mixu-radar
- roryg-ghostwriter
- thomasf-solarizedcssdark
- thomasf-solarizedcsslight
- witex
- –export
:将内置布局导出到目录 - –highlight-
:指定用于特定语言的自定义突出显示器模块 - –no-header-links:如果传递此标志,则不会生成标题链接的HTML。默认情况下启用悬停链接。
网址: https://github.com/mixu/markdown-styles
Notepad++ 相关问题
安装 markdown 插件
下载后导入语言
参考:https://github.com/Edditoria/markdown-plus-plus
IntelliJ IDEA 相关问题
导入外部jar文件
File –> Project Structure -> Project Settings -> Modules -> Dependencies -> 点加号 -> JARS or directories..
Android Studio 相关问题
删除最近项目
File / Open Recent / Manage Projects..
Flutter 相关问题
Running “flutter packages get” 加载太久
1 | flutter packages get --verbose |
参考:https://github.com/flutter/flutter/issues/15162
公众号相关问题
该网页由mp.weixin.qq.com提供
有的公众号商城显示该网页由mp.weixin.qq.com提供
链接为
可以进入到公众号后台 > 功能 > 微信小店 > 货架管理(商品管理) 生成二维码或链接
微信公众平台的简称“MP”
Media Platform(媒体平台)的缩写