S
S
Shadrindmitry2019-08-24 19:19:45
Android
Shadrindmitry, 2019-08-24 19:19:45

Why does databinding with VKSdk not work?

Error at compile time: [databinding] {"msg":"cannot find method login(android.content.Context, java.lang.Object) in class com.vk.sdk.VKSdk"

layout xmlns:android="http://schemas.android.com/apk/res/android">

    <data>
        <import type="com.vk.sdk.VKSdk"/>
    </data>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    tools:context=".ui.AuthorizationActivity">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:onClick="@{() -> VKSdk.login(context, null)}"

        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

public class AuthorizationActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        ActivityAuthorizationBinding binding =
                DataBindingUtil.setContentView(this, R.layout.activity_authorization);
        
    }
}

apply plugin: 'com.android.application'

project.ext {
    appcompatVersion = "1.0.2"
    materialVersion = "1.0.0"
    constraintlayoutVersion = "1.1.3"
    vectordrawableVersion = "1.0.1"
    navigationfragmentVersion = "2.0.0"
    navigationuiVersion = "2.0.0"
    lifecycleVersion = "2.0.0"
    appcompatVersion = "1.0.2"
    constraintlayoutVersion = "1.1.3"
    vksdkVersion = "1.6.7"
}

android {
    compileSdkVersion 28
    buildToolsVersion "29.0.1"
    defaultConfig {
        applicationId "com.example.dps"
        minSdkVersion 15
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }
    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        }
    }

    dataBinding {
        enabled = true
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation "androidx.appcompat:appcompat:$project.appcompatVersion"
    implementation "com.google.android.material:material:$project.materialVersion"
    implementation "androidx.constraintlayout:constraintlayout:$project.constraintlayoutVersion"
    implementation "androidx.vectordrawable:vectordrawable:$project.vectordrawableVersion"
    implementation "androidx.navigation:navigation-fragment:$project.navigationfragmentVersion"
    implementation "androidx.navigation:navigation-ui:$project.navigationuiVersion"
    implementation "androidx.lifecycle:lifecycle-extensions:$project.lifecycleVersion"
    implementation "androidx.appcompat:appcompat:$project.appcompatVersion"
    implementation "androidx.constraintlayout:constraintlayout:$project.constraintlayoutVersion"

    // VK SDK
    implementation "com.vk:androidsdk:$project.vksdkVersion"

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.1.1'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2019-08-24
@Shadrindmitry

If you look at the source , there really is no such method. There is a method that accepts activations and varargs of strings.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question