踩坑及问题解决记录贴合集 不定时更新

ubuntu篇

ubuntu 20.04中文输入法安装谷歌输入法

linux下AndroidSutdio不能调试:Debugger process finished with exit code 127. A library required by the native debugger might be missing on your system. See idea.log file for more details.

ubuntu突然没有网络

ubuntu突然没有网络,网络图标消失不见
重启网络

sudo service network-manager restart

开发

Android开发

安装APK报错Failure [INSTALL_FAILED_TEST_ONLY]

安装APK报错Failure [INSTALL_FAILED_TEST_ONLY]

安装失败!调用者不被允许测试的测试程序

解决方法一:修改AndroidManifest.xmlapplication标签中删去 android:testOnly="true"属性
解决方法二:使用adb install -t app.apk添加-t参数来安装

api

必应每日一图

https://www.bing.com/HPImageArchive.aspx?format=js&idx=1&n=1

idx:索引
n:数量
images[0].url拼接主域名https://www.bing.com使用

NDK开发

“NDK does not contain any platforms.”
  • 问题描述:在Project Structure的SDK Location中配置NDK Location时,会出现报错"NDK does not contain any platforms."
  • 原因:在NDK r19开始,platform已经被废弃,但是AndroidStudio依旧会检测

    For people seeing this in 2021:
    The Android NDK’s platform directory has been obsolete since r19. The NDK team removed it altogether in r21 in January 2021. Although it is obsolete, it can still cause the above error in the Project Structure window. The stable version of the Android Studio IDE (at least on Mac) is still looking for the platform directory when you select an r21 or higher version and try to Apply it. The IDE gives the error “NDK does not contain any platforms.”
    Until Android Studio is updated to stop looking for platform, you can edit the local.properties file yourself, like so:

    ndk.dir=/Users/[username]/Library/Android/sdk/ndk/22.0.7026061
    sdk.dir=/Users/[username]/Library/Android/sdk
    

    This is what the Project Structure window would normally do for you behind the scenes.
    参考自android studio - NDK does not contain any platforms - Stack Overflow

  • 解决方法:
    1. 降低NDK版本到r19以下
    2. 手动在local.properties中设置ndk.dir

Python

python不能使用代理
  1. 命令行使用,配置命令
    export http_proxy="http://127.0.0.1:10808"
    export https_proxy="http://127.0.0.1:10808"
    
  2. 代码中使用代理
    import os
    os.environ["http_proxy"] = "http://127.0.0.1:1231"
    os.environ["https_proxy"] = "http://127.0.0.1:1231"
    
  3. requests设置代理
    前面的几种方式会为所有的HTTP请求设置代理,如果只想让部分请求使用代理,可以使用requests的proxies参数:
    	import requests
    	proxies = {'http': "socks5://127.0.0.1:8080",
           		'https': "socks5://127.0.0.1:8080"}
    	print(requests.get(url, proxies=proxies).content)
    

详见 python 使用代理的几种方式_whatday的博客-CSDN博客_python 代理

python url编码

python urllib.parse.quote('')结果与Java URLEncoder.encode(s,"UTF-8")结果不一致的问题

使用如下代码即可

import urllib.parse
urllib.parse.quote(str).replace('%20', '+').replace('%2A', '*').replace('/', '%2F').replace('~', '%7E')

Java

IDEA maven项目中获得resources
new File( MainActivity.class.getClassLoader().getResource("xx.apk").getFile() );
new File( MainActivity.class.getResource("/xx.apk").getFile() );

软件篇

IDEA

IDEA Tomcat与控制台 乱码
  • 通过注册表修改Tomcat命令窗口的默认字符编码为UTF-8即可解决
    • 第一步:Windows+R打开运行,输入regedit进入注册表编辑器

    • 第二步:路径 计算机\HKEY_CURRENT_USER\Console\Tomcat,如果没有,在Console下新建项Tomcat

    • 第三步:新建DWORD值CodePage,右键->修改->10进制65001

    • 可以解决Tomcat startup.bat乱码

IDEA控制台乱码解决

首先要分清是tomcat日志编码,与idea的日志显示控制台编码

  • tomcat日志编码:tomcat根目录\bin\catalina.bat

    • 首行添加chcp 65001切换cmd为utf8
    • chcp 936切换cmd为gbk(题外话,不需要做)
    • 确定tomcat日志编码,一般因为tomcat/conf/logging.propertiesjava.util.logging.ConsoleHandler.encoding = UTF-8已设置为utf8

    做了上一步,可以不做这一步

  • idea显示编码:windows默认用gbk所以idea显示默认为gbk编码

    • 【一定】在 Help-- custom vm options 添加
      -Dfile.encoding=UTF-8
      
    • 强制为utf8编码显示,不要自己改.vmoptions,可能位置不对,idea会在用户目录复制一个
    • 【切忌】自己改tomcat的logging.properties 为GBK 会导致调试时IDEA get/post参数乱码
IDEA编译项目时不将src目录下的xml配置文件复制过去

IDEA的maven项目中,默认源代码目录下(src/main/java目录)的xml等资源文件并不会在编译的时候一块打包进classes文件夹,而是直接舍弃掉。
如果使用的是Eclipse,Eclipse的src目录下的xml等资源文件在编译的时候会自动打包进输出到classes文件夹。

配置maven的pom文件配置,在pom文件中找到节点,添加下列代码

<build>
    <resources>
        <resource>
            <directory>src/main/java</directory>
            <includes>
                <include>**/*.xml</include>
                <include>**/*.properties</include>
            </includes>
        </resource>
    </resources>
</build>

含义:编译时复制java下所有类型为xmlproperties类型的文件到相应classes文件目录下
如果想复制所有,使用通配符**/*.*

    <!-- 默认的IDEA配置 -->
<resource>
    <directory>src/main/resources</directory>
    <includes>
        <include>**/*.*</include>
    </includes>
</resource>

原blog:https://blog.csdn.net/wqh0830/article/details/85851230

AndroidStudio

Sdk/tools/monitor.bat在jdk11下不能运行

log日志

!SESSION 2022-01-09 13:21:19.046 -----------------------------------------------
eclipse.buildId=unknown
java.version=11.0.10
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=zh_CN
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -data @noDefault

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.634
!MESSAGE Bundle reference:file:org.apache.ant_1.8.3.v201301120609/@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.637
!MESSAGE Bundle reference:file:org.apache.jasper.glassfish_2.2.2.v201205150955.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.637
!MESSAGE Bundle reference:file:org.apache.lucene.core_2.9.1.v201101211721.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.686
!MESSAGE Bundle reference:file:org.eclipse.help.base_3.6.101.v201302041200.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.687
!MESSAGE Bundle reference:file:org.eclipse.help.ui_3.5.201.v20130108-092756.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.687
!MESSAGE Bundle reference:file:org.eclipse.help.webapp_3.6.101.v20130116-182509.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.689
!MESSAGE Bundle reference:file:org.eclipse.jetty.server_8.1.3.v20120522.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.692
!MESSAGE Bundle reference:file:org.eclipse.platform.doc.user_4.2.2.v20130121-200410.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.692
!MESSAGE Bundle reference:file:org.eclipse.team.core_3.6.100.v20120524-0627.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.693
!MESSAGE Bundle reference:file:org.eclipse.team.ui_3.6.201.v20130125-135424.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.694
!MESSAGE Bundle reference:file:org.eclipse.ui.cheatsheets_3.4.200.v20120521-2344.jar@4 not found.

!ENTRY org.eclipse.osgi 4 0 2022-01-09 13:21:19.695
!MESSAGE Bundle reference:file:org.eclipse.ui.intro_3.4.200.v20120521-2344.jar@4 not found.

解决办法:

  1. 切换JAVA_HOME为jdk8
  2. 但我不想使用jdk8:复制jdk8的jre文件夹粘贴成Sdk\tools\lib\monitor-x86_64\jre(原来没有jre文件夹)(或复制AndroidStudio自带的jre)
AndroidStudio 报错中文乱码

在AndroidStudio安装目录bin目录下,找到以下两个文件

Android Studio\bin\studio64.exe.vmoptions
Android Studio\bin\studio.exe.vmoptions

打开末尾添加

-Dfile.encoding=UTF-8

解决

Navicat Premium15激活报错

报错信息:

激活失败。原因可能是由于已达到激活次数的上限。请检查你是否已在 卸载或重新安装Navicat前取消许可证秘钥。 90010003

卸载重装,断网激活

编码乱码

在这里插入图片描述

Hexo BUG

不要使用{#

报错信息

Unhandled rejection Template render error: (unknown path)
  Error: expected end of comment, got end of file

解决方法:{不要与#紧挨着,中间加个空格即可。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Forgo7ten

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值