无法解决Android Studio 3.2中的依赖项错误

时间:2018-10-05 20:30:05

标签: compiler-errors

我正在开发我的应用程序,并且一切运行顺利,直到今天为止我的依存关系都没有问题,所有方法都以红色突出显示(在我的.java文件中),指出错误“无法解析方法”。我不知道会发生什么,但是现在我无法正常运行构建。

这是我的.gradle脚本:       应用插件:“ com.android.application”

apply plugin: 'kotlin-android'

apply plugin: 'kotlin-android-extensions'

android {
    apply plugin: 'com.android.application'
    compileSdkVersion 28
    defaultConfig {
        applicationId "com.hoochybaybe.backyardigans"
        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'
        }
    }
}

dependencies {
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
   // implementation 'com.android.support:appcompat-v8:28.0.0'
    implementation "com.android.support:support-core-utils:28.0.0"
    implementation 'com.android.support.constraint:constraint-layout:1.1.3'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    implementation 'com.google.firebase:firebase-database:16.0.4'
    implementation 'com.google.firebase:firebase-core:16.0.4'
    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.google.android.gms:play-services-maps:16.0.2'
        implementation 'com.google.firebase:firebase-ml-model- 
   interpreter:16.2.2'
        implementation 'com.google.maps.android:android-maps-utils:0.5+'
    }
    subprojects {
        project.configurations.all {
            resolutionStrategy.eachDependency { details ->
                if (details.requested.group == 'com.android.support'
                     && !details.requested.name.contains('appcompat-v7') ) {
                details.useVersion "26.1.0"
            }
        }
    }
}
apply plugin: 'com.google.gms.google-services'
com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = 
true

这是我的.java文件:

package com.hoochybaybe.backyardigans;

import android.content.Intent;
import android.os.Bundle;
import android.support.v8.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

public class MainActivity extends AppCompatActivity {
    private Button mBackyarder, mNeeder; //mBackyarder,

    @Override
    protected void onCreate(Bundle savedInstanceState){
    super.onCreate(savedInstanceState);
    //to resolve R issues create a java R file, go to File -> Invalidate 
Caches / Restart... -> Invalidate and Restart
    setContentView(R.layout.activity_main);

    mBackyarder= (Button)findViewById(R.id.Backyarder);
    mNeeder= (Button)findViewById(R.id.Needer);

    mBackyarder.setOnClickListener(new View.OnClickListener(){
    @Override
    public void onClick(View v){
    Intent intent = new Intent(MainActivity.this, 
BackyarderLoginActivity.class);
    startActivity(intent);
    finish();
    return;
    }

    });

    mNeeder.setOnClickListener(new View.OnClickListener(){
            @Override
            public void onClick(View v){
                    Intent intent = new Intent(MainActivity.this, 
NeederLoginActivity.class);
                    startActivity(intent);
                    finish();
                    return;
                    }

            });

    }


}

0 个答案:

没有答案