简体   繁体   中英

setting gradle file when installing Facebook sdk

I am very new to Android and setting gradle files is still cryptic for me. Everything went fine until I added facebook as a library.

I set in my manifest file

<uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="19" />

and I get this error message

/$home/app/build/exploded-bundles/ComAndroidSupportAppcompatV72100Rc1.aar/AndroidManifest.xml

Failed to parse <uses-sdk minSdkVersion='L'>: must be an integer number or codename.
Failed to parse <uses-sdk targetSdkVersion='L'>: must be an integer number or codename.

Here's the architecture of my app :

MyProject
  - app
    - build.gradle (1)
  - facebook
    - - build.gradle (2)

build.gradle (3)

Here's the setting of (1)

apply plugin: 'android'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        minSdkVersion 14
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    buildTypes {
        release {
            runProguard false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

dependencies {
    compile 'com.android.support:appcompat-v7:+'
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile project(':libs:facebook')
}

here's the setting of (2)

apply plugin: 'android-library'

dependencies {
    compile files('./libs/bolts.jar')
    compile 'com.android.support:support-v4:19.1.+'
}

android {
    compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION) // set to 19
    buildToolsVersion project.ANDROID_BUILD_TOOLS_VERSION // set to 19

    defaultConfig {
        minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION) // set to 14
        targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION) // set to 19
    }

    lintOptions {
        abortOnError false
    }

    sourceSets {
        main {
            manifest.srcFile 'AndroidManifest.xml'
            java.srcDirs = ['src']
            res.srcDirs = ['res']
        }
    }
}

and (3)

// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.8.+'
    }
}

allprojects {
    repositories {
        mavenCentral()
    }
}

尝试添加到您的build.gradle (1)

compile 'com.android.support:appcompat-v7:19.1.0'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM