简体   繁体   中英

cannot resolve AppCompatActivity for v7:23.+

I have an existing android app which i am migrating to Marshmallow. When i changed by build.gradle and dependancies for support:appcompat-v7, i started realizing a strange issue. My activity class which extends AppCompatActivity is showing errors.

this is my build.gradle

apply plugin: 'com.android.library'


android {
compileSdkVersion 23
buildToolsVersion '23.0.3'
defaultConfig {
    minSdkVersion 14
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}

buildTypes {
    debug{
        buildConfigField "String", "ANDROIDPAY_PUBLIC", "\"""
        buildConfigField "String", "ANDROIDPAY_PRIVATE", """
    }
    release {
        buildConfigField "String", "ANDROIDPAY_PUBLIC", " "String", "ANDROIDPAY_PRIVATE", "\"""
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
publishNonDefault true //for maintaining product flavor

productFlavors {
     {
    }
     {
    }
}
lintOptions {
    abortOnError false
}
}


dependencies {
compile 'com.google.android.gms:play-services-analytics:8.4.0'
compile 'com.google.android.gms:play-services-appindexing:8.4.0'
compile 'com.google.android.gms:play-services-wallet:8.4.0'
compile 'com.google.android.gms:play-services-gcm:8.4.0'
compile 'com.google.android.gms:play-services-plus:8.4.0'
compile 'com.google.android.gms:play-services-identity:8.4.0'
compile 'com.google.android.gms:play-services-appstate:8.4.0'
compile 'com.google.android.gms:play-services-base:8.4.0'
compile 'com.google.guava:guava:18.0'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.android.support:cardview-v7:23.4.0'
compile 'com.android.support:support-v4:23.4.0'
compile 'com.android.support:recyclerview-v7:23.4.0'
compile 'com.facebook.android:facebook-android-sdk:4.0.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.squareup.picasso:picasso:2.5.2'
compile files('libs/GoogleConversionTrackingSdk-2.2.2.jar')
compile files('libs/AF-Android-SDK-v3.3.0.jar')
compile files('libs/crittercism_v5_3_3_sdkonly.jar')
compile files('libs/Kahuna.jar')
compile('com.optimizely:optimizely:1.4.2@aar') {
    transitive = true
    exclude group: 'com.google.code.gson', module: 'gson'
    exclude group: 'com.squareup.okhttp3', module: 'okhttp'
}
compile 'io.card:android-sdk:5.3.0'
compile 'io.jsonwebtoken:jjwt:0.6.0'
compile "com.squareup.okhttp3:okhttp:3.0.1"
compile files('libs/commons-codec-1.10.jar')
compile files('libs/bcprov-jdk15on-154.jar')
/*compile 'com.paypal.sdk:paypal-android-sdk:2.13.3'*/
compile 'net.hockeyapp.android:HockeySDK:4.1.0-beta.1'
compile files('libs/devicecollector-sdk-2.6.jar')
}

In activity i am using this code

public abstract class BaseController extends AppCompatActivity{

....
}

The error i am getting is cannot resolve symbol 'AppCompatActivity'

Everything is working fine when i am using compile 'com.android.support:appcompat-v7:22.4.0'. Problem arises while using 23.+ versions.

It is solved. Problem was with Android Studio. I had to Invalidate caches and restart Android Studio and voila problem solved.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM