ActionBarSherlock - The type android.support.v4.app.Fragment cannot be resolved. It is indirectly referenced from required .class files

前端 未结 9 1434
走了就别回头了
走了就别回头了 2020-12-02 18:41

I am using ActionBarSherlock as a library project in a project which is a library itself. It was all working fine until I moved the project to a new computer and updated the

相关标签:
9条回答
  • 2020-12-02 19:10

    I had same problem. There were 2 different libraries. Delete support library from your main project

    0 讨论(0)
  • 2020-12-02 19:10

    I was using Android Studio and faced with similar problem(for loading ListFragment). I had initially imported library:

    import android.support.v4.app.ListFragment;

    And then updated build.gradle inside app diectory: Make sure dependencies section includes support libraries-

      dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:20.0.0 }
    
    0 讨论(0)
  • 2020-12-02 19:16

    Sebastien's answer actually led me to the solution. However, it is important to mention that the support library has to be added manually to the build path in order to be able to check it for exporting. For future reference, here are the steps that solved the problem for me:

    1. Make sure the support library is in the libs folder of the ABS project and nowhere else
    2. Right-click on the library --> Build path --> Add to build path
    3. Right-click on ABS project --> Properties --> Java Build Path --> Order and Export --> Check the android-support-v4.jar file and save
    4. Right-click on the project where you have included ABS --> Properties --> Java Build Path --> Order and Export --> Check the "Android Private Libraries" and save
    5. If you have additional projects in your dependency hierarchy, do step 4 for all of this projects
    6. Clean the entire workspace (or all affected projects) and hope the best.

    However, it is a mystery for me why this has to be so complicated - as Josh mentioned, Eclipse in combination with Android and large projects with a couple of dependencies is hard to use and I hope this will be improved in near future.

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