Android 7引入了对证书处理方式的一些更改(http://android-developers.blogspot.com/2016/07/changes-to-trusted-certificate.html),不知怎的,我不能让我的Charles代理工作了.
我的network_security_config.xml:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config>
<trust-anchors>
<certificates src="system" />
</trust-anchors>
</base-config>
<debug-overrides>
<trust-anchors>
<certificates src="user" />
</trust-anchors>
</debug-overrides>
</network-security-config>
Run Code Online (Sandbox Code Playgroud)
我正在调试模式下运行.但不管怎样,我明白了javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
.
不用说,我确实安装了pfx
证书Settings -> Security -> Install from storage
.证书显示在User Credentials
但不在Trusted credentials -> User
.在我的棒棒糖设备上,证书列在那里.
我正在使用okhttp3作为HTTP库.
知道我做错了什么吗?
我只是启用instant run
了我的android工作室项目.(按照这里的说明)
我的项目包含git
子模块,不知怎的,这些子模块不再编译.
这是我得到的错误:
错误:(8,0)在解析后,无法更改配置':libraries:my_library:classpath'的依赖关系.
知道那可能有什么问题吗?
顶级build.gradle:
buildscript {
repositories {
mavenCentral()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:2.0.0-alpha1'
classpath 'com.novoda:bintray-release:0.2.7'
classpath 'io.fabric.tools:gradle:1.+'
}}
Run Code Online (Sandbox Code Playgroud)
模块build.gradle:
apply plugin: 'android'
apply plugin: 'io.fabric'
android {
defaultConfig {
versionCode 4850
versionName '4850'
compileSdkVersion 23
buildToolsVersion '23.0.1'
}
packagingOptions {
exclude 'META-INF/LICENSE'
exclude 'META-INF/MANIFEST.MF'
exclude 'META-INF/NOTICE'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
useLibrary 'org.apache.http.legacy'
}
repositories {
mavenCentral()
jcenter()
} …
Run Code Online (Sandbox Code Playgroud) 我刚启动了我的项目的即时运行.构建和上传速度更快,但我的应用启动时间从几百毫秒增加到几秒钟.
我对这种妥协感到满意.我只是想知道我是否是唯一注意到这一点的人,是否有机会对此进行优化?
自从将Nexus 5X升级到Android N后,使用EditText时出现以下崩溃:
java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x2/d=0x101009b a=1}
at android.content.res.TypedArray.getColorStateList(TypedArray.java:528)
at android.text.style.TextAppearanceSpan.<init>(TextAppearanceSpan.java:65)
at android.text.style.TextAppearanceSpan.<init>(TextAppearanceSpan.java:45)
at android.widget.Editor$SuggestionsPopupWindow.setUp(Editor.java:3316)
at android.widget.Editor$PinnedPopupWindow.<init>(Editor.java:3016)
at android.widget.Editor$SuggestionsPopupWindow.<init>(Editor.java:3309)
at android.widget.Editor.replace(Editor.java:356)
at android.widget.Editor$3.run(Editor.java:2129)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Run Code Online (Sandbox Code Playgroud)
单击已包含某些文本的EditText时会发生这种情况.我假设它是自动正确的弹出窗口或类似的东西.
我的应用程序使用支持库24.2.0和Theme.AppCompat.Light.NoActionBar
编辑:如果我android:colorAccent
只colorAccent
在我的主题中添加它,它工作正常:
<style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/mainBrandColor</item>
<item name="colorPrimaryDark">@color/mainBrandDarkerColor</item>
<item name="colorAccent">@color/mainBrandColor</item>
<item name="android:colorAccent">@color/mainBrandColor</item>
</style>
Run Code Online (Sandbox Code Playgroud)
但是,当我从Theme.AppCompat继承时,不应该这样做.
我做了一个小应用程序,展示了这个问题:
我有一个包含3个子项目的项目.我希望3个子项目使用相同的依赖项版本,因此我考虑了根目录中的所有版本build.gradle
:
allprojects {
ext.versions = [
supportLibVersion: '26.1.0',
playServicesVersion: '11.2.2',
retrofitVersion: '2.1.0',
retrofitConverterGsonVersion: '2.1.0',
retrofitRxjava2AdapterVersion: '1.0.0',
rxjava2Version: '2.0.5',
rxandroidVersion: '2.0.1',
timberVersion: '4.5.1',
...
]
}
Run Code Online (Sandbox Code Playgroud)
现在lint不再突出显示新库了.它在某种程度上仍然适用于supportLibs,但不适用于其他的.
我有机会再次使用它吗?
是否有任何实际情况,其中View.getParent
()返回一个非类型的对象ViewGroup
?或者我可以安全地投射它而不首先检查它的类型,如下面的代码示例中所示?
if (getParent() == null){
throw new IllegalStateException("View does not have a parent, it cannot be rootview!");
}
ViewGroup parent = (ViewGroup) getParent();
Run Code Online (Sandbox Code Playgroud) 下面的代码有什么问题?运行时,我得到:"在连接(.)中使用未初始化的值或在./main.pl第14行使用字符串"
#!/usr/bin/perl
package Test;
use Moose;
has 'message' => (isa => 'HashRef', is => 'ro', default => sub{{(localtime)[2] => {(localtime)[3] => "hello"}}});
# the one below works fine
#has 'message' => (isa => 'HashRef', is => 'ro', default => sub{{"18" => {"16" => "hello"}}});
sub show {
my $self = shift;
print("Test: " . $self->message->{(localtime)[2]}->{(localtime)[3]} . "\n");
}
my $o = Test->new();
$o->show();
Run Code Online (Sandbox Code Playgroud)
如果我不使用localtime()那么它工作正常.本地时间[2]和[3]也不会经常变化(2小时,3是月日)所以问题不是那样.如果我用调试器运行脚本,我得到:
x $self
0 Test=HASH(0x3597300)
'message' => HASH(0x3597618)
16 => 'hello'
Run Code Online (Sandbox Code Playgroud)
所以看起来我'失去'一级间接,不确定为什么......任何想法?
使用以下代码:
#include <stdio.h>
struct my_struct {
int a;
int b;
my_struct();
};
my_struct::my_struct(void)
{
printf("constructor\n");
}
void my_struct(void)
{
printf("standard function\n");
}
int main (int argc, char *argv[])
{
struct my_struct s;
s.a = 1;
s.b = 2;
printf("%d-%d\n", s.a, s.b);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到一个用g ++ -Wshadow main.cpp编译的警告:
main.cpp:15:20: warning: ‘void my_struct()’ hides constructor for ‘struct my_struct’
Run Code Online (Sandbox Code Playgroud)
如果void my_struct函数实际上替换了my_struct :: my_struct,那么我可以使用该警告.但似乎并非如此.如果我运行该程序,我得到:
constructor
1-2
Run Code Online (Sandbox Code Playgroud)
知道这个警告意味着什么吗?特别是当我将C头包含在C++代码中时,这非常烦人
我有以下目录结构:
base/
dir/
subdir/
link -> ../dir
Run Code Online (Sandbox Code Playgroud)
现在,如果我CD到目录/链接并键入:
cd ../subd[tab]
Run Code Online (Sandbox Code Playgroud)
我得到:
cd ../subdir[space]
Run Code Online (Sandbox Code Playgroud)
我会理解自动完成是否失败(因为它将完成路径并查找base /而不是dir /)。
我也将了解它是否cd ../subdir/
以/结束自动完成(因为它将解释..
为go up one level
dir /并搜索到dir /)。
但是我不了解两者之间的实际行为。理想情况下,我希望bash表现为2。(自动完成cd ../subdir/)。我正在使用fedora 14,bash版本4.1.7(1)。任何想法如何做到这一点?
android ×6
android-lint ×1
android-view ×1
autocomplete ×1
bash ×1
c++ ×1
default ×1
dependencies ×1
g++ ×1
gradle ×1
groovy ×1
moose ×1
perl ×1
ssl ×1
symlink ×1