Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Databinding Redirection to xml is not working in android studio 3.1.2

I have updated android studio to latest version(3.1.2) and now when I click on BindingClass with ctrl it's not opening xml file for it which was working in previous version. And I have tried the same thing with creating new project in same version of android studio but it's working on it.

So I am thinking that I have added some wrong dependencies or I have done something wrong. So please guide me regarding this issue.

Here is the 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'

Here is the Project Level 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
}

Thank you so much.

like image 642
Rujul Gandhi Avatar asked Apr 26 '18 12:04

Rujul Gandhi


1 Answers

For opening related XML

Android Studio has a new icon for related XML redirection. My AS version is 3.2.1.

sc3

An hack for opening Binding Class.

  • Ctrl + N (Open File)
  • Type ActivityMainBinding {or first letters - Amb for ActivityMainBinding if you are smart enough :)
  • Hit enter on ActivityMainBinding

sc1

sc2

FYI I faced this problem in Java class only, [Go to declaration] works well with kotlin.

like image 171
Khemraj Sharma Avatar answered Sep 18 '22 00:09

Khemraj Sharma