gpt4 book ai didi

android - 到 xml 的数据绑定(bind)重定向在 android studio 3.1.2 中不起作用

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:13:43 25 4
gpt4 key购买 nike

我已经将 android studio 更新到最新版本 (3.1.2),现在当我用 ctrl 单击 BindingClass 时,它不会打开在以前版本中工作的 xml 文件。我已经尝试过在相同版本的 android studio 中创建新项目,但它正在处理它。

所以我在想我添加了一些错误的依赖项或者我做错了什么。所以请指导我解决这个问题。

这里是build.gradle

buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}

dependencies {
classpath 'io.fabric.tools:gradle:1.+'
}
}
apply plugin: 'com.android.application'
apply plugin: 'com.google.firebase.firebase-perf'
apply plugin: 'realm-android'
apply plugin: 'io.fabric'

android {
compileSdkVersion 27
defaultConfig {
applicationId = "xxx.xxx.xxx"
minSdkVersion 18
targetSdkVersion 27
versionCode 9
versionName "1.0.8"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
dexOptions {
javaMaxHeapSize "4g"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// signingConfig signingConfigs.config
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
}
debug {
buildConfigField 'Boolean', 'enableCrashlytics', 'false'
}
}
flavorDimensions "default"
productFlavors {
basic {
// applicationIdSuffix ".basic"
// versionName "0.1.9"
}
admin {
// applicationIdSuffix ".admin"
// versionName "0.1.9-admin"
}
}
dataBinding {
enabled = true
}
packagingOptions {
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.properties'
exclude 'META-INF/maven/com.squareup.okhttp3/okhttp/pom.xml'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.properties'
exclude 'META-INF/maven/com.squareup.okio/okio/pom.xml'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation(name: 'wikitudesdk', ext: 'aar')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
implementation 'com.android.support:appcompat-v7:27.1.0'
implementation 'com.android.support:design:27.1.0'
implementation 'com.google.android.gms:play-services-maps:11.6.0'
implementation 'com.google.android.gms:play-services-location:11.6.0'
implementation 'com.google.android.gms:play-services-analytics:11.6.0'
testImplementation 'junit:junit:4.12'
implementation 'com.squareup.okhttp3:okhttp:3.5.0'
implementation('com.squareup.retrofit2:retrofit:2.1.0') {
exclude module: 'okhttp'
}
implementation('com.squareup.retrofit2:adapter-rxjava:2.1.0') {
exclude module: 'okhttp'
}
implementation('com.squareup.retrofit2:converter-gson:2.1.0') {
exclude module: 'okhttp'
}
implementation('com.squareup.okhttp3:logging-interceptor:3.5.0') {
exclude module: 'okhttp'
}
implementation 'com.google.dagger:dagger:2.8'
annotationProcessor 'com.google.dagger:dagger-compiler:2.8'
implementation 'io.reactivex:rxandroid:1.2.1'
implementation 'io.reactivex:rxjava:1.1.6'
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
implementation 'com.google.android:flexbox:0.3.0-alpha2'
annotationProcessor 'org.parceler:parceler:1.1.6'
implementation 'org.parceler:parceler-api:1.1.6'
implementation 'com.google.guava:guava:20.0'
implementation 'me.zhanghai.android.materialprogressbar:library:1.3.0'
implementation 'com.facebook.fresco:fresco:1.1.0'
implementation 'com.facebook.fresco:animated-gif:1.1.0'
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.caverock:androidsvg:1.2.1'
implementation 'joda-time:joda-time:2.9.3'
implementation 'com.google.code.gson:gson:2.8.0'
implementation 'io.realm:android-adapters:1.3.0'
implementation 'com.mobsandgeeks:android-saripaar:2.0.2'
implementation 'org.greenrobot:eventbus:3.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.jakewharton.timber:timber:4.5.1'
implementation('com.crashlytics.sdk.android:crashlytics:2.7.1@aar') {
transitive = true
}
implementation 'com.github.JakeWharton:ViewPagerIndicator:2.4.1'
implementation 'com.google.android.exoplayer:exoplayer:r2.2.0'
implementation 'com.github.faruktoptas:FancyShowCaseView:0.1.0'
implementation 'com.google.firebase:firebase-messaging:11.6.0'
implementation 'com.facebook.android:facebook-android-sdk:4.28.0'

implementation 'com.shawnlin:number-picker:2.4.4'
implementation 'com.squareup.picasso:picasso:2.5.2'
implementation 'com.google.maps.android:android-maps-utils:0.5'
implementation 'com.intuit.sdp:sdp-android:1.0.4'
implementation 'com.google.firebase:firebase-perf:11.6.0'
implementation 'com.facebook.stetho:stetho:1.5.0'
implementation 'com.uphyca:stetho_realm:2.1.0'
// debugCompile 'com.squareup.leakcanary:leakcanary-android:1.5'

// releaseCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'

// testCompile 'com.squareup.leakcanary:leakcanary-android-no-op:1.5'
}

repositories {
flatDir {
dirs 'libs'
}
maven { url 'https://maven.fabric.io/public' }
}

apply plugin: 'com.google.gms.google-services'

这里是项目级别的build.gradle

buildscript {
repositories {
jcenter()
maven { url 'https://maven.fabric.io/public' }
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.0.1'
classpath "io.realm:realm-gradle-plugin:3.0.0"
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.google.gms:google-services:3.1.1'
classpath 'me.tatarka:gradle-retrolambda:3.6.1'
classpath 'com.google.firebase:firebase-plugins:1.1.4'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

allprojects {
repositories {
jcenter()
maven {url "https://jitpack.io"}
maven {url 'https://github.com/uPhyca/stetho-realm/raw/master/maven-repo'}
google()
}
}

task clean(type: Delete) {
delete rootProject.buildDir
}

非常感谢。

最佳答案

用于打开相关的XML

Android Studio 有一个用于相关 XML 重定向的新图标。我的 AS 版本是 3.2.1。

sc3

打开绑定(bind)类的 hack。

  • Ctrl + N(打开文件)
  • 键入 ActivityMainBinding {或第一个字母 - ActivityMainBinding 的 Amb 如果你足够聪明的话:)
  • ActivityMainBinding 上按回车键>

sc1

sc2

仅供引用,我只在 Java 类中遇到过这个问题,[Go to declaration] 与 kotlin 配合得很好。

关于android - 到 xml 的数据绑定(bind)重定向在 android studio 3.1.2 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50043566/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com