无法解决v7的AppCompatActivity:23. +

时间:2016-05-30 12:28:49

标签: java android android-activity

我有一个现有的Android应用程序,我正在迁移到Marshmallow。当我通过build.gradle和dependancies改变支持:appcompat-v7时,我开始意识到一个奇怪的问题。扩展AppCompatActivity的我的活动类显示错误。

这是我的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')
}

在活动中我正在使用此代码

public abstract class BaseController extends AppCompatActivity{

....
}

我得到的错误是无法解析符号' AppCompatActivity'

我使用时一切正常 编译' com.android.support:appcompat-v7:22.4.0'。使用23. +版本时出现问题。

1 个答案:

答案 0 :(得分:1)

它解决了。问题出在Android Studio上。我不得不使缓存失效并重新启动Android Studio并解决了问题。