我已经安装了 Android Studio 4.1 Canary ,但是 Layout Inspector 根本没有显示实时更新和进程。从Android Studio设置启用了实验性功能,但未发生任何事情。
这是我的 build.gradle 文件。因此,一切看起来都不错,但没有显示实时更新。
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs.kotlin"
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.example.test"
minSdkVersion 21
targetSdkVersion 29
buildToolsVersion "29.0.3"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
configurations.all {
resolutionStrategy {
force 'androidx.appcompat:appcompat:1.1.0'
force 'com.google.android.exoplayer:exoplayer:2.10.4'
}
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: "libs", include: ["*.jar"])
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'androidx.core:core-ktx:1.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
}
答案 0 :(得分:1)
您必须在API 29或更高版本中运行Android Studio项目,才能实时查看Android Studio Canary版本的布局检查器的更新。
答案 1 :(得分:1)
有一个类似的问题,似乎布局检查器可与最新的Android版本模拟器一起使用。
不是使用API 28仿真器,而是使用API 29仿真器。
答案 2 :(得分:0)
更新 Android Studio 4.1 Canary 2 后,此问题已解决。现在一切正常。