23

I have just set up android studio and am trying to compile my first project. The project gets compiled but when the 'Choose Device' menu opens the device and state is shown as [OFFLINE] and compatible gives message Android error message Android error 'No, minSdk(API 19) > deviceSdk(API 1)' What does this mean? How can I solve it?

my build.grandle file looks like this

    apply plugin: 'com.android.application'

android {
    compileSdkVersion 21
    buildToolsVersion "21.1.2"

    defaultConfig {
        applicationId "com.yaron.myapplication"
        minSdkVersion 19
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:22.0.0'
}
Zoe
  • 27,060
  • 21
  • 118
  • 148
develop1
  • 747
  • 1
  • 10
  • 32

19 Answers19

29

There are a few things to check.

if you go to the terminal window in Android Studio and cd to the path where your sdk platform tools are installed (something like C:\Android\SDK\platform-tools ) and run the following command

adb devices

Do you have a device listed? If not then you don't have the device setup properly, or the correct drivers.

On the phone make sure that you have developer options enabled (go to settings->about phone and click on the Build Number 7 times or so)

Once you have enabled that go into the develop options under settings and make sure USB debugging is enabled.

If adb devices said "no permission" for the device you are connecting, make sure to connect it as MTP device first. This will implicitly prompt you to import the computer's fingerprint and allow future connections for USB debugging as well.

Brian S
  • 3,096
  • 37
  • 55
  • 6
    if you have this option already checked, uncheck and then check again while device is conected to your PC – jarosik Oct 22 '15 at 13:08
  • Do adb devices first. That was my fix. See here http://stackoverflow.com/questions/9210152/set-up-device-for-development-no-permissions – jim Feb 13 '16 at 02:42
  • 1
    Please add @Jordi's answer below to this answer.`adb devices` listed the device but said "no permission" for me, thus Android Studio could not tell the API version and assumed 1 (see original question!). Connecting as MTP implicitly solved the issue. Admittedly, many people will have done that before, but if you are debugging with many devices, it may well be that you have not done it before. – Simon Fischer Feb 15 '16 at 20:52
10

In build.gradle file, change the minSdkVersion to 7

cegprakash
  • 2,937
  • 33
  • 60
8

ADB Secure device authorizations are stored in a white-list located in the adb directory. if you want to connect to the ADB daemon running on the android device from a process running on the device via tcp as localhost then the connection is successful but the Authorisation prompt is not displayed and the device is shown as Offline.

You need to have root access in order to remove RSA keys from the white-list. When the pop up "Allow USB Debugging" comes on the phone screen, press "Ok" to enable it. if not unplug and re-plug to see the prompt.

enter image description here

Reagan Ochora
  • 1,642
  • 1
  • 19
  • 22
8

Same problem with a tablet with Android 4.4.2, in my case solved enabling MTP:

Settings-> Storage-> Three dots on top right->USB computer connection->Emable "Media device (MTP)"

Of course, debugging was already enabled.

sKhan
  • 9,694
  • 16
  • 55
  • 53
Jordi
  • 81
  • 1
  • 2
  • I can confirm it for android 5.1.1 and sony z3 compact, MTP mode helps in this situation. – xwild Feb 26 '16 at 15:40
  • For me it was exactly the opposite. I had to set the tablet to FTP, instead of MTP. Strange :S – MSX Feb 29 '16 at 12:59
4

Following steps solved my problem

Step 1: Open your Android Studio, and go to Menu. File >Project Structure

Step 2: In project Structure window, select app module in the list given on left side.

Step 3: Select the Flavors tab and under this you will have an option for setting “Min Sdk Version” and for setting “Target Sdk Version”.

Step 4: Select both the versions and Click OK.

Excerpt from http://abhiandroid.com/androidstudio/change-api-sdk-level-android-studio.html

Good luck

notnotundefined
  • 3,493
  • 3
  • 30
  • 39
3

Got same error 'Compatible No, minSdk(API 19) > deviceSdk(API 1)' in Android Studio Device Chooser for Samsung Tablet with Android 4.4.2. The below simple steps resolved the issue for me:

  1. Disconnect the USB debug cable
  2. Open Developer Options in Settings on the device
  3. Click Revoke USB debugging authorizations
  4. Click OK to 'USB debugging access will be revoked from all the computers you have previously authorized'
  5. Reconnect over USB and accept the new 'Allow USB debugging' authorization for this computer
  6. Start a new debugging session
Jay
  • 221
  • 1
  • 5
2

This most likely means that you have not allowed USB debugging. When you connect your device to your computer, your device should prompt you to "Allow USB debugging?" Just hit OK to enable it.

tachyonflux
  • 20,103
  • 7
  • 48
  • 67
2

The issue is with build tools version that you are using.

Please try the following:

Android Studio=>Open your project=>File=>Project Structure=>app(i.e left pannel)=>Properties=>Build Tools Version=>

Select 19.1.0.

It worked fine for me..Just try it out :)

Raj
  • 31
  • 1
2

the storage space of my smartphone was full. After cleaning up I was able to use it and the device was "compatible".

Thomas
  • 21
  • 1
1

Change the minSdkVersion to your target device sdkVersion in build.gradle(Module:app) file will be appear on left side in Gradle Scripts.

Ex: minSdkVersion 24

Change the version value to your target device value (23, 22, 21 or other)

According to your configuration you have to change the minSdkVersion 19 to minSdkVersion 1, because your target device is at API Level 1.

joaumg
  • 1,238
  • 1
  • 12
  • 27
0

I had this problem on a VirtualBox Linux (Ubuntu 15.10 guest on a 14.04 host). adb devices showed unauthorized.

In this case, this was fixed by adding a /etc/udev/rules.d/51-android.rules with the proper rule on the guest and clearing all previous authorizations under developer options on the Android device. (Was set previously to the same computer as the device was rooted for CyanogenMod.)

Marc
  • 1
0

You have to set to connect as camera(even after usb debugging is already enabled)

enter image description here

Answer taken from Android Studio recognizes physical Device as Null?

Community
  • 1
  • 1
Aristo Michael
  • 2,166
  • 3
  • 35
  • 43
0

I had this same problem. My resolution in Android Studio was to set check on:
Tools -> Android -> Enable ADB Integration

Javoslaw
  • 357
  • 2
  • 6
0

Unplug and re-plug to see if the prompt appears and click on allow. Of course, USB debugging must be enabled from developer options. And the mobile's driver must be installed on the pc (if on windows).

0

This problem went away when I disabled and re-enabled USB debugging in my Android device's Developer Options settings.

akiraspeirs
  • 2,127
  • 2
  • 21
  • 29
0

In the bundle.gradle(Module: app) change minSdkVersion 19 from 19 to 1. This fixed my probem

sammy ongaya
  • 1,313
  • 1
  • 15
  • 14
0

****I resolve my this error by installing new android device with API 19 and than runs fine.....

sarmad
  • 1
0

On your file build.gradle you need to add the correct API of your deviceSdk.

minSdkVersion 1

minSdk(API 19) > deviceSdk(API 1)

https://i.stack.imgur.com/AkEYY.png

i am using USB and my Connected Device

Ganesh Manickam
  • 2,113
  • 3
  • 20
  • 28
jgv
  • 141
  • 3
0

Goto your Project's Gradle Script >> build.gradle (Module: app) Change minSdkVersion as show below

apply plugin: 'com.android.application'

android {

compileSdkVersion 26
defaultConfig {
    applicationId "com.example.rehman.doctorportal"

minSdkVersion 17

Change it to two numbers small of your error's number

    targetSdkVersion 26
    versionCode 1
    versionName "1.0"
    testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

}

Abdul Rehman
  • 25
  • 11