我正在使用Androis Studio 3.0 Canary 4.在我的项目中,我有Linkedin-sdk,它的工作原理.我可以用它.唯一的问题是,当我搜索构建Gradle时,我会收到此消息.

因为我不能构建它我不能使用设计编辑器和预览.
这是我的build.gradle项目:
buildscript {
repositories {
jcenter()
maven { url 'https://maven.google.com' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.0-alpha4'
classpath 'com.google.gms:google-services:3.0.0'
}
}
allprojects {
repositories {
jcenter()
maven {
url 'https://maven.google.com'
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
Run Code Online (Sandbox Code Playgroud)
Build.Gradle模块:App
apply plugin: 'com.android.application'
android {
compileSdkVersion 26
buildToolsVersion "26.0.0"
defaultConfig {
applicationId "com.cving_team.cving"
minSdkVersion 19
targetSdkVersion 26
versionCode 1
versionName "1.0"
testInstrumentationRunner
"android.support.test.runner.AndroidJUnitRunner"
}
signingConfigs {...}
buildTypes {
sdkTest {
signingConfig signingConfigs.sdkTest
debuggable true …Run Code Online (Sandbox Code Playgroud) 我的目的是让一个看不见的LinearLayout在点击特定按钮时显示为动画.为此,我将默认高度设置为WRAP_CONTENT,获取应用程序启动时的高度,将高度设置为0,并在单击按钮时启动动画.这是代码:
linearLayout.post(new Runnable() {
@Override
public void run(){
height = linearLayout.getMeasuredHeight();
linearLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 0));
}
});
findViewById(R.id.btnOperator).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Animation ani = new ShowAnim(linearLayout, height/* target layout height */);
ani.setDuration(1000/* animation time */);
linearLayout.startAnimation(ani);
}
});
Run Code Online (Sandbox Code Playgroud)
这项工作还不错,但我想做的不同.我希望默认高度为0,然后计算WRAP_CONTENT高度,并将其传递给:
Animation ani = new ShowAnim(linearLayout, height/* target layout height */);
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?我搜索但发现了什么.
我使用Retrofit和OkHttp3来发出请求.我知道在Android 4.4 TLS 1.1和TLS 1.2中没有启用defult.所以我想尝试启用它们.但到目前为止,我没有成功.我读到这可能是android工作室模拟器的一个问题,但是我无法在带有andoroid 4.4 rigthnow的真实设备上进行测试
这是我到目前为止所做的:
private <S> S createService(Class<S> serviceClass) {
Retrofit retrofit = builder.client(getNewHttpClient()).build();
return retrofit.create(serviceClass);
}
private OkHttpClient getNewHttpClient() {
OkHttpClient.Builder clientBuilder = new OkHttpClient.Builder()
.connectTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS)
.readTimeout(0, TimeUnit.MINUTES); // Disable timeouts for read
return enableTls12OnPreLollipop(clientBuilder).build();
}
public static OkHttpClient.Builder enableTls12OnPreLollipop(OkHttpClient.Builder client) {
if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
try {
client.sslSocketFactory(new TLSSocketFactory());
ConnectionSpec cs = new ConnectionSpec.Builder(ConnectionSpec.MODERN_TLS)
.tlsVersions(TlsVersion.TLS_1_2)
.build();
List<ConnectionSpec> specs = new ArrayList<>();
specs.add(cs);
specs.add(ConnectionSpec.COMPATIBLE_TLS);
specs.add(ConnectionSpec.CLEARTEXT);
client.connectionSpecs(specs);
} catch (Exception exc) { …Run Code Online (Sandbox Code Playgroud)