import android packages cannot be resolved

前端 未结 9 1584
时光说笑
时光说笑 2020-12-14 15:12

My android application, built inside Eclipse, suddenly fails to build with dozens of errors. The most obvious are errors indicating that all the android imports cannot be r

相关标签:
9条回答
  • 2020-12-14 16:11

    right click on project->properties->android->select target name as "Android 4.4.2" --click ok

    since DocumentsContract is added in API level 19

    0 讨论(0)
  • 2020-12-14 16:14

    What all the others said.

    Specifically, I recommend you go to Project > Properties > Java Build Path > Libraries and make sure you have exactly one copy of android.jar referenced. (Sometimes you can get two if you're importing a project.) And that its path is correct.

    Sometimes you can get the system to resolve this for you by clicking a different target SDK in Project > Properties > Android, then restoring your original selection.

    0 讨论(0)
  • 2020-12-14 16:15

    May be you are using this checking :

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
    }
    

    To resolve this you need to import android.provider.DocumentsContract class.

    To resolve this issue you'll need to set the build SDK version to 19 (4.4) or higher to have API level 19 symbols available while compiling.

    First, use the SDK Manager to download API 19 if you don't have it yet. Then, configure your project to use API 19:

    • In Android Studio: File -> Project Structure -> General Settings -> Project SDK.
    • In Eclipse ADT: Project Properties -> Android -> Project Build Target

    I found this answer from here

    Thanks .

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