Android Gradle版本未更新

时间:2018-09-24 10:54:06

标签: java android

   apply plugin: 'com.android.application'

    android {
        compileSdkVersion 26
        defaultConfig {
            applicationId "com.example.dk"
            minSdkVersion 22
            targetSdkVersion
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            multiDexEnabled true

        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
    }

    dependencies {
        implementation fileTree(dir: 'libs', include: ['*.jar'])
        implementation 'com.android.support:appcompat-v7:26.1.0'
        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.android.support:support-vector-drawable:26.1.0'
        implementation 'com.android.support:support-annotations:26.1.0'
        implementation 'com.android.support:design:26.1.0'


        implementation 'com.google.firebase:firebase-core:16.0.3'
        implementation 'com.google.firebase:firebase-auth:16.0.3'
        implementation 'com.google.firebase:firebase-database:16.0.2'
        implementation 'com.google.firebase:firebase-storage:16.0.2'
        implementation 'com.google.firebase:firebase-messaging:17.3.2'
        implementation 'com.google.firebase:firebase-firestore:17.1.0'

        //different ui screens
        implementation 'com.intuit.sdp:sdp-android:1.0.5'

        // circular imageview
        implementation 'de.hdodenhof:circleimageview:2.2.0'

        // to load image from url
        implementation 'com.squareup.picasso:picasso:2.71828'
        //to create cardview
        implementation 'com.android.support:cardview-v7:26.1.0'


        //to implement google map
        implementation 'com.google.android.gms:play-services-maps:15.0.1'


        implementation 'com.google.code.gson:gson:2.8.4'


        implementation 'com.google.android.gms:play-services-nearby:15.0.1'

        //recycler swipe to delete item
        implementation "com.daimajia.swipelayout:library:1.2.0@aar"

        // country code picker
        implementation 'com.github.joielechong:countrycodepicker:2.1.5'

          // to load gif
        implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.15'

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

以下是我的logcat错误,

error: method does not override or implement a method from a supertype  
error: cannot find symbol method getWindow()    
error: cannot find symbol method getWindow()    
error: cannot find symbol method getSupportFragmentManager()    
error: incompatible types: OnboardingActivity cannot be converted to Context    
error: cannot find symbol method findViewById(int)  
error: cannot find symbol method findViewById(int)  
error: cannot find symbol method findViewById(int)  
error: incompatible types: OnboardingActivity cannot be converted to Context    
error: incompatible types: OnboardingActivity cannot be converted to Context    
error: cannot find symbol method finish()   
error: method does not override or implement a method from a supertype  
error: method does not override or implement a method from a supertype  

error: method does not override or implement a method from a supertype  
error: cannot find symbol method setContentView(int)    
error: cannot find symbol method findViewById(int)  
error: cannot find symbol method findViewById(int)  
error: cannot find symbol method startActivity(Intent)  
error: incompatible types: PhoneNumberLogin cannot be converted to Context  
error: method does not override or implement a method from a supertype  
error: cannot find symbol method getApplicationContext()    
error: cannot find symbol method finish()   
error: no suitable method found for addOnCompleteListener(PhoneNumberLogin,<anonymous OnCompleteListener<AuthResult>>)
method Task.addOnCompleteListener(Executor,OnCompleteListener<AuthResult>) is not applicable
(argument mismatch; PhoneNumberLogin cannot be converted to Executor)
method Task.addOnCompleteListener(Activity,OnCompleteListener<AuthResult>) is not applicable
(argument mismatch; PhoneNumberLogin cannot be converted to Activity)   
error: cannot find symbol method startActivity(Intent)  
error: cannot find symbol method getApplicationContext()    
error: cannot find symbol method finish()   
error: incompatible types: ProgressCircleActivity cannot be converted to Context    
error: cannot find symbol method startActivity(Intent)  

成绩同步失败。所有的Java文件都给出了错误,我尝试更改版本并同步gradle,但错误仍然相同。

在Java文件 context,appCompactActivity,Intent,startActivity,firebaseStorage 中,这些组件对我不起作用。到目前为止,我一直在为这个问题苦苦挣扎,我无法找到解决方案。

请帮助我修复。

2 个答案:

答案 0 :(得分:0)

您缺少targetSdkVersion

targetSdkVersion 26

答案 1 :(得分:0)

尝试删除构建文件夹,gradle缓存,然后清理项目并运行。