5

Please install a compatible Android API level (15 or higher)

Trying to run a new robotium test I get this error. Does anyone know how to fix it?

I've all the APIs needed. (15 and a lot of higher APIs). What am I missing?

This is part of my gradle file:

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.2"

    defaultConfig {
        applicationId "com.centervue.exam"
        minSdkVersion 19
        targetSdkVersion 25
        // DO NOT PUT HERE VERSION NAME, THX. Change the Manifest

        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"

        ndk {
            moduleName "exam_filter"
            ldLibs "log", "jnigraphics"
        }
        renderscriptTargetApi 18
        renderscriptSupportModeEnabled true
    }
[...]

UPDATE: after changing every support library versions from 25+ or + to at least 25.+ to avoid mixed libraries... it works and starts. Although now I get this message:

The JavaCompile.setDependencyCacheDir() method has been deprecated and is scheduled to be removed in Gradle 4.0. Incremental java compilation is an incubating feature. FAILURE: Build failed with an exception. * What went wrong: A problem occurred configuring root project 'executorproject'. > org.gradle.api.internal.tasks.DefaultTaskInputs$TaskInputUnionFileCollection cannot be cast to org.gradle.api.internal.file.collections.DefaultConfigurableFileCollection * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. BUILD FAILED Total time: 1.883 secs

Any idea? We are almost there I think.

Filnik
  • 352
  • 1
  • 12
  • 33

2 Answers2

3
  1. From your project/android panel, press F4 to open the project structure. Select SDK Location and check that the Android SDK location path is in fact the same SDK installation you have downloaded your API's to.

  2. Make sure the Emulator or device has at least API 15 installed (>= ICE_CREAM_SANDWICH_MR1)

  3. Ensure the exact same API is available in your SDK as your device:

User Guide: Make sure the Android API level of the connected device or emulator is available in the Android SDK Manager

  1. Open your Module Gradle file and make sure that compileSdkVersion & targetSdkVersion (and maybe minSdkVersion & buildToolsVersion) versiona are at least 15

  2. (For the benefit of any future readers) Make sure you have a test set up for it to run, otherwise you don't have the option

Nick Cardoso
  • 20,807
  • 14
  • 73
  • 124
  • 1
    I've added part of my gradle file. I've tried what you said, still get the same problem :( I've an emulator with 22 API installed and a device with 19 API. Still not working. The SDK location is the right one and I've both 19 and 22 API installed. – Filnik Mar 23 '17 at 14:07
  • you may require adding the Android Studio plugin for robotium https://robotium.com/pages/installation-android-studio – Aloy A Sen Mar 28 '17 at 12:05
  • None of these worked. The SDK location is correct, the API level was 23 and the API is downloaded completely. All "versions" are set to minimum 17. Robotium is out of my list now. Gonna stick with Espresso. – Abdalrahman Shatou Apr 29 '17 at 22:11
1

To fix this problem, beside what told by Nick Cardoso, I've:

  • created a new AVD and from there installed all the AVD libraries of the 25 library. Google's APIs included. It didn't worked.
  • I've tried opening File > Settings > Systems settings > Android SDK > Clicked on the "Edit" button next to the SDK location and re-installed the Android SDK from the view that opens from there.
  • I've checked every support library in my dependencies moving them from :+ or 25+ to at least 25.+ to avoid libraries version mismatch.

Now I get no more this problem (but I have the one described in the description).

Filnik
  • 352
  • 1
  • 12
  • 33