IntelliJ 12 + ActionBarSherlock settings: Could not find class 'android.support.v4.app.FragmentActivity'

前端 未结 4 630
花落未央
花落未央 2020-12-08 08:20

There are numerous Q&A about IntelliJ 12 + ABS(ActionBarSherlock) settings.

similar case to this question but shows different errors.

Overall compilation

相关标签:
4条回答
  • 2020-12-08 08:50

    I also had this problem in Android Studio (Version 1.1.0) when I wanted to check/test the "EffectiveNavigation"-App from the google examples (Link: http://developer.android.com/training/implementing-navigation/lateral.html)

    What I had to do was to add this code snippet at the path ".\EffectivNavigation\app\builde.gradle":

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:support-v4:20.0.0'
    }
    

    So the whole build.gradle looks like this:

    apply plugin: 'com.android.application'
    
    android {
        compileSdkVersion 21
        buildToolsVersion "21.1.2"
    
        defaultConfig {
            applicationId "com.example.android.effectivenavigation"
            minSdkVersion 14
            targetSdkVersion 14
        }
    
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
            }
        }
    }
    
    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:support-v4:20.0.0'
    }
    

    You can also use

    compile 'com.android.support:support-v4:20.+'
    

    instead of

    compile 'com.android.support:support-v4:20.0.0'
    

    Maybe this answer is more helpfull for you than the other answers.

    0 讨论(0)
  • 2020-12-08 08:56

    This configuration is not correct, the scope of the android-support-v4 library must be set to Compile as it's not present on Android and must be included in your application.

    Second copy of android-support-v4 must be removed from the application dependencies, it will be available to your application via a library module that has Export option enabled for android-support-v4.

    0 讨论(0)
  • 2020-12-08 09:03

    Just for the record - this solved the problem for me: (via https://stackoverflow.com/a/35248120/2409397 )

    Build > Rebuild Project.

    0 讨论(0)
  • 2020-12-08 09:10

    I added adt/sdk/extras/android/support/v4/android-support-v4.jar (adt should point to the android sdk) to the classpath of the Android SDK in Idea.

    0 讨论(0)
提交回复
热议问题