-3

I have project which needs to be ported in Gradle build, I have done most of work but not able to change the target SDK for the build, since my application is heavily dependent on third party SDK. It is present in addons directory of SDK manager.

Here is the Eclipse project structure

eclipse structure

project build target in eclipse is

project build target eclipse

The Gradle project structure is

gradle structure

build.gradle in app directory

apply plugin: 'com.android.application'

android {
    compileSdkVersion 22
    buildToolsVersion "22.0.1"

    defaultConfig {
        applicationId "com.name.appname"
        minSdkVersion 15
        targetSdkVersion 22
        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.2.1'
}

I have following queries

  1. Where to make the changes in which file or directory?

  2. Do I need to add addon library sdk in the gradle build, If yes, then where??

Thank you for being helpful and down voting, at-least explain why you down voted.

4

2 回答 2

2

This is what need to change in order to compile through different sdk, In your build.gradle present in app directory. E.g \app\build.gradle

Change the compileSdkVersion. For eg

android {
    compileSdkVersion 'TazTag:TazPad3 Add-On tuvalu_01.01.346:16'
    // the sdk version mentioned above is the sdk which you want to add
    // please specify correct sdk to build with
    buildToolsVersion "22.0.1"
}

Use compileSdkVersion to number when you are going for Android as project target.

Thank you to all who down-voted, without even understanding the problem, you helped me...I did by myself.

Feel free to query if you anyone have trouble regarding the solution.

于 2015-07-27T12:46:43.857 回答
0

You need to change the value for targetSdkVersion on your app build.gradle file.

defaultConfig {
        applicationId "uk.co.myapp"
        minSdkVersion 14
        targetSdkVersion 21
        versionCode 1
        versionName "1.0"
    }
于 2015-07-27T11:10:11.470 回答