当我导入此库实现'com.android.volley:volley:1.0.0'时。我正在从“活动和视图”中失去联系

时间:2018-10-28 08:22:19

标签: android android-studio android-volley findviewbyid

当我将此库实现'com.android.volley:volley:1.0.0'放入我的Grandle文件时,我无法使用findViewById方法将变量连接到视图。 这是我的Grandle文件:

apply plugin: 'com.android.application'

    android {
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.dimosthenis.seetheworld"
        minSdkVersion 16
        targetSdkVersion 28
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner 
"android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 
'proguard-rules.pro'
        }
    }
}

    //google told me to write this
    repositories {
    mavenCentral()
}

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:appcompat-v7:28.0.0-rc02'
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.2'
    androidTestImplementation 'com.android.support.test.espresso:espresso- 
core:3.0.2'
    implementation 'com.loopj.android:android-async-http:1.4.9'
    implementation 'com.google.api-client:google-api-client:1.23.0'
    //implementation 'com.android.volley:volley:1.0.0'
    //compile 'com.google.api-client:google-api-client:1.23.0'
}

当凌空库在注释中时,该文件可以完美运行。否则findViewById找不到我的视图的ID。其实在“ R”之后。该ID消失了。

EditText loginEmail = (EditText) findViewById(R.id.email_login);
EditText loginPassword = (EditText) findViewById(R.id.password_login);

0 个答案:

没有答案