Android 问题收集
约 247 字
预计阅读 1 分钟
收集一些遇到的安卓问题解决方案。
安卓常见问题
- Android SDK - reposit:
1
2
3
| $ touch ~/.android/repositories.cfg
$ ./Android/Sdk/tools/bin/sdkmanager --update
$ ./Android/Sdk/tools/bin/sdkmanager --licenses
|
- Expiring Daemon because JVM heap space is exhausted:
1
2
3
4
| // gradle.properties
org.gradle.daemon=true
org.gradle.configureondemand=true
org.gradle.jvmargs=-Xmx4g -XX:MaxPermSize=2048m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
|
- Could not find com.jakewharton:butterknife-compiler:7.0.1:
1
2
3
| // app/build.gradle
implementation 'com.jakewharton:butterknife:7.0.1'
annotationProcessor 'com.jakewharton:butterknife:7.0.1'
|
8.0 以上版本参考:
- java.security.cert.CertPathValidatorException: Trust anchor for certification path not found:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
| // 将证书下载到 app/src/main/raw 目录下,然后在 app/src/main/res/xml 目录下添加 network_secruity_config.xml 文件
$ touch app/src/main/res/xml/network_secruity_config.xml
$ vim app/src/main/res/xml/network_secruity_config.xml
<?xml version="1.0" encoding="utf-8"?>
<network-security-config xmlns:tools="http://schemas.android.com/tools">
<debug-overrides>
<trust-anchors>
<certificates overridePins="true" src="system" />
<certificates overridePins="true" src="user" />
<certificates src="@raw/certificate" />
</trust-anchors>
</debug-overrides>
<domain-config>
<domain includeSubdomains="true">example.com</domain>
<trust-anchors>
<certificates src="@raw/certificate" />
</trust-anchors>
</domain-config>
<base-config cleartextTrafficPermitted="true">
<trust-anchors>
<certificates src="@raw/certificate" />
<certificates src="system" />
</trust-anchors>
</base-config>
</network-security-config>
// 在 app/src/main/AndroidManifest.xml 文件中添加以下配置
$ vim app/src/main/AndroidManifest.xml
<application
...
android:networkSecurityConfig="@xml/network_secruity_config"
...>
...
</application>
|