Joey Yi Zhao
Joey Yi Zhao

Reputation: 42500

How to choose compileSdkVersion and buildToolsVersion for a given device?

My device is installing Android 4.3. When I try to install an Android app on that device through Android Studio, I got compatible "minSdk (API 18) > deviceSdk(API 1)". I wander how to choose compatible version for that device. Below is my build.gradle file:

apply plugin: 'com.android.application'

android { compileSdkVersion 23 buildToolsVersion '23.0.1'
defaultConfig {
    applicationId "com.example.yzzhao.myapplication"
    minSdkVersion 18
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}
}

Upvotes: 0

Views: 6792

Answers (4)

Joey Yi Zhao
Joey Yi Zhao

Reputation: 42500

I finally figured it out that the problem is because the device is not authorised by my computer. After reset enable USB debug, it works.

Upvotes: 0

Joey Yi Zhao
Joey Yi Zhao

Reputation: 42500

My device is installing Android 4.3. When I try to install an Android app on that device through Android Studio, I got compatible "minSdk (API 18) > deviceSdk(API 1)". I wander how to choose compatible version for that device. Below is my build.gradle file:

apply plugin: 'com.android.application'

android { compileSdkVersion 23 buildToolsVersion '23.0.1'

defaultConfig {
    applicationId "com.example.yzzhao.myapplication"
    minSdkVersion 18
    targetSdkVersion 23
    versionCode 1
    versionName "1.0"
}
buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}
compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_7
    targetCompatibility JavaVersion.VERSION_1_7
}

}

Upvotes: -1

Nandhu
Nandhu

Reputation: 68

If you're using android studio /Go to file -> Project Structure->application. Then set your compile sdk version in properties tab and min/target sdk version in flavours tab.

Upvotes: 0

DGN
DGN

Reputation: 702

Since your Android phone version is Android 4.3(API level 18), you can use compileSdkVersion 18 for actual accurate result. buildToolsVersion should be 18.0.1 or higher

Upvotes: 3

Related Questions